Part Number Hot Search : 
SDH0114 V301HA40 BCW60C V044ME01 BCW60C 4ACT2 B1020 601VW
Product Description
Full Text Search
 

To Download ADUC814ARU Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  microconverter ? , small package 12-bit adc with embedded flash mcu aduc814 rev. a information furnished by analog devices is believed to be a ccurate and reliable. however, no responsibility is assumed by analog devices for its use, nor for any infringements of patents or other rights of third parties that may result from its use. specifications subject to chan ge without notice. no license is granted by implication or otherwise under any patent or patent ri ghts of analog devices. trademarks and registered trademarks are the prop erty of their respective owners. one technology way, p.o. box 9106, norwood, ma 02062-9106, u.s.a. tel: 781.329.4700 www.analog.com fax: 781.326.8703 ? 2003 analog devices, inc. all rights reserved. features analog i/o 6-channel 247 ksps adc 12-bit resolution adc high speed data capture mode programmable reference via on-chip dac for low level inputs, adc performance specified to v ref = 1 v dual voltage output dacs 12-bit resolution, 15 s settling time memory 8 kbytes on-chip flash/ee program memory 640 bytes on-chip flash/ee data memory flash/ee, 100 year retention, 100 kcycle endurance 3 levels of flash/ee program memory security in-circuit serial downlaod (no external hardware) 256 bytes on-chip data ram 8051 based core 8051 compatible instruction set 32 khz external crystal, on-chip programmable pll (16.78 mhz max) three 16-bit timer/counters 11 programmable i/o lines 11 interrupt sources, 2 priority levels power specified for 3 v and 5 v operation normal: 3 ma @ 3 v (core clk = 2.1 mhz) power-down: 15 a (32 khz oscillator running) on-chip peripherals power-on reset circuit (no need for external por device) temperature monitor (1.5c accuracy) precision voltage reference time interval counter (wake-up/rtc timer) uart serial i/o spi ? /i 2 c? compatible serial i/o watchdog timer (wdt), power supply monitor (psm) package and temperature range 28-lead tssop 4.4 mm 9.7 mm package fully specified for ?40 c to +125c operation applications optical networkinglaser power control base station systemspower amplifier bias control precision instruments, smart sensors battery-powered systems, precision system monitors functional block diagram aduc814 prog. clock divider xtal2 xtal1 t/h ain mux temp monitor internal band gap v ref ain0 v ref c ref ain5 osc and pll dac1 dac0 buf buf dac0 dac1 dac control logic 12-bit adc adc control logic buf power- on reset 8 kbytes flash/ee program memory 640 bytes flash/ee data memory 256 bytes user ram 3 16-bit timer/counters 1 wake-up/rtc timer 10 digital i/o pins 8051-based mcu with additional peripherals on-chip monitors power supply monitor watchdog timer uart and spi serial i/o 02748-a-001 figure 1. general description the aduc814 is a fully integrated 247 ksps, 12-bit data acquisi- tion system incorporating a high performance multichannel adc, an 8-bit mcu, and program/data flash/ee memory on a single chip. this low power device operates from a 32 khz crystal with an on-chip pll generating a high frequency clock of 16.78 mhz. this clock is, in turn, routed through a programmable clock divider from which the mcu core clock operating frequency is generated. the microcontroller core is an 8052 and is compatible with an 8051 instruction. 8 kbytes of nonvolatile flash/ee program memory are provided on-chip. 640 bytes of nonvolatile flash/ee data memory and 256 bytes ram are also integrated on-chip. the aduc814 also incorporates additional analog functionality with dual 12-bit dacs, a power supply monitor, and a band gap reference. on-chip digital peripherals include a watchdog timer, time interval counter, three timer/counters, and two serial i/o ports (spi and uart). on-chip factory firmware supports in-circuit serial download and debug modes (via uart), as well as single-pin emulation mode via the dload pin. the aduc814 is supported by a quickstart? development system. the part operates from a single 3 v or 5 v supply over the extended temperature range ?40c to +125c. when operating from 3 v supplies, the power dissipation for the part is below 10 mw. the aduc814 is housed in a 28-lead tssop package.
aduc814 rev. a | page 2 of 72 table of contents specifications..................................................................................... 4 absolute maximum ratings............................................................ 9 esd caution.................................................................................. 9 pin configuration and function description ............................ 10 terminology .................................................................................... 12 adc specifications .................................................................... 12 dac specifications..................................................................... 12 typical performance curves ......................................................... 13 aduc814 architecture, main features ....................................... 16 memory organization ............................................................... 17 overview of mcu-related sfrs.............................................. 18 accumulator sfr ................................................................... 18 b sfr........................................................................................ 18 stack pointer sfr ................................................................... 18 data pointer ............................................................................ 18 program status word sfr..................................................... 18 power control sfr................................................................. 19 special function registers ........................................................ 20 adc circuit information.............................................................. 21 general overview....................................................................... 21 adc transfer function............................................................. 21 adc data output format .................................................... 21 sfr interface to adc block ..................................................... 22 adccon1 (adc control sfr 1) .......................................... 22 adccon2 (adc control sfr 2) .......................................... 23 adccon3 (adc control sfr 3) .......................................... 24 driving the adc............................................................................. 25 voltage reference connections................................................ 26 configuring the adc ................................................................ 26 initiating adc conversions ..................................................... 27 adc high speed data capture mode .................................... 27 adc offset and gain calibration overview ......................... 28 adc offset and gain calibration coefficients ..................... 28 calibrating the adc .................................................................. 29 initiating calibration in code .................................................. 29 nonvolitile flash/ee memory ...................................................... 30 flash/ee memory overview .................................................... 30 flash/ee memory and the aduc814...................................... 30 aduc814 flash/ee memory reliability................................. 30 using flash/ee program memory........................................... 31 serial downloading (in-circuit programming)................ 31 parallel programming............................................................ 31 flash/ee program memory security....................................... 31 lock mode .............................................................................. 31 secure mode ........................................................................... 31 serial safe mode ..................................................................... 31 using flash/ee data memory.................................................. 32 econflash/ee memory control sfr ........................... 32 flash/ee memory timing ........................................................ 33 using the flash/ee memory interface ................................ 33 programming a byte .............................................................. 33 user interface to other on-chip aduc814 peripherals.......... 34 dacs ............................................................................................ 34 using the dacs ...................................................................... 35 on-chip pll .............................................................................. 37 time interval counter (tic).................................................... 38 watchdog timer......................................................................... 41 power supply monitor ............................................................... 42 aduc814 configuration register (cfg814) ........................ 43 serial peripheral interface..................................................... 43 external clock ........................................................................ 43
aduc814 rev. a | page 3 of 72 serial peripheral interface..........................................................44 miso (master in, slave out data i/o pin) .........................44 mosi (master out, slave in pin)..........................................44 sclock (serial clock i/o pin) ...........................................44 ss (slave select input pin) .....................................................44 using the spi interface...........................................................45 spi interfacemaster mode .................................................45 spi interfaceslave mode ....................................................45 i 2 c compatible interface............................................................46 8051 compatible on-chip peripherals....................................47 parallel i/o ports 1 and 3.......................................................47 additional digital outputs pins ...........................................47 timers/counters .........................................................................48 timer/counter 0 and 1 data registers ................................49 timer/counter 0 and 1 operating modes...............................50 mode 0 (13-bit timer/counter) ...........................................50 mode 1 (16-bit timer/counter) ...........................................50 mode 2 (8-bit timer/counter with autoreload)................50 mode 3 (two 8-bit timer/counters)...................................50 timer/counter 2 data registers...........................................51 timer/counter 2 operating modes .........................................52 16-bit autoreload mode.........................................................52 16-bit capture mode ..............................................................52 uart serial interface.................................................................53 sbuf.........................................................................................53 mode 0: 8-bit shift register mode .......................................54 mode 1: 8-bit uart, variable baud rate ............................54 mode 2: 9-bit uart with fixed baud rate ........................55 mode 3: 9-bit uart with variable baud rate....................55 uart serial port baud rate generation ............................55 timer 2 generated baud rates .............................................56 interrupt system..........................................................................57 interrupt priority ....................................................................59 interrupt vectors.....................................................................59 aduc814 hardware design considerations ..............................60 clock oscillator...........................................................................60 power supplies.............................................................................60 power consumption...................................................................60 power-saving modes ..............................................................61 power-on reset ......................................................................61 grounding and board layout recommendations .............61 other hardware considerations...............................................62 in-circuit serial download access ......................................62 embedded serial port debugger ..........................................62 single-pin emulation mode ..................................................63 timing specifications .....................................................................64 outline dimensions........................................................................70 ordering guide ...........................................................................71 revision history 12/03 C data sheet changed from rev. 0 to rev. a added detailed description of product ........................... universal changes to specifications.................................................................4 updated outline dimensions........................................................70 changes to ordering guide...........................................................71
aduc814 rev. a | page 4 of 72 specifications table 1. av dd = dv dd = 2.7 v to 3.3 v or 4.5 v to 5.5 v, v ref = 2.5 v internal reference, xtal1/xtal2 = 32.768 khz crystal. all specifications t min to t max , unless otherwise specified 1 parameter v dd = 5 v v dd = 3 v unit test conditions adc channel specifications a grade dc accuracy 2,3 f sample = 147 khz resolution 12 12 bits integral nonlinearity 2 2 lsb max 2.5 v internal reference 1 1 lsb typ 2.5 2.5 lsb typ 1.0 v external reference differential nonlinearity 4 4 lsb max 2.5 v internal reference 2 2 lsb typ 5 5 lsb typ 1.0 v external reference calibrated endpoint errors 4, 5 offset error 5 5 lsb max offset error match 1 1 lsb typ gain error 5 5 lsb max gain error match 1 1 lsb typ dynamic performance 6 f in = 10 khz sine wave f sample = 147 khz signal to noise ratio (snr) 7 62.5 62.5 db typ total harmonic distortion (thd) C65 C65 db typ peak harmonic or spurious no ise C65 C65 db typ channel-to-channel crosstalk 8 C80 C80 db typ b grade dc accuracy 2, 3 f sample = 147 khz resolution 12 12 bits integral nonlinearity 1 1 lsb max 2.5 v internal reference 0.3 0.3 lsb typ 1.5 1.5 lsb max 1.0 v external reference 11 differential nonlinearity 0.9 0.9 lsb max 2.5 v internal reference 0.25 0.25 lsb typ +1.5/C0.9 1.5/C0.9 lsb max 1.0 v external reference 11 code distribution 1 1 lsb typ adc input is a dc voltage calibrated endpoint errors 4, 5 offset error 2 3 lsb max offset error match 1 1 lsb typ gain error 2 3 lsb max gain error match 1 1 lsb typ dynamic performance 6 f in = 10 khz sine wave f sample = 147 khz signal to noise ratio (snr) 7 71 71 db typ total harmonic distortion (thd) C85 C85 db typ peak harmonic or spurious no ise C85 C85 db typ channel-to-channel crosstalk 8 C80 C80 db typ analog input input voltage ranges 0 to v ref 0 to v ref v leakage current 1 1 a max input capacitance 32 32 pf typ
aduc814 rev. a | page 5 of 72 parameter v dd = 5 v v dd = 3 v unit test conditions temperature monitor 9 voltage output at 25oc 650 650 mv typ voltage tc C2 C2 mv/oc typ accuracy 3 3 oc typ 2.5 v internal reference accuracy 1.5 1.5 oc typ 2.5 v external reference dac channel specifications dac load to agnd rl = 10 k?, cl = 100 pf dc accuracy 10 resolution 12 12 bits relative accuracy +3 +3 lsb typ differential nonlinearity 11 C1 C1 lsb max guaranteed montonic 1/2 1/2 lsb typ offset error 50 50 mv max v ref range gain error 1 1 % max v ref range 1 1 % typ av dd range gain error mismatch 0.5 0.5 % typ of full scale on dac1 analog outputs voltage range_0 0 to v ref volts dac v ref = 2.5 v voltage range_1 0 to v dd volts dac v ref = v dd output impedance 0.5 0.5 ? typ i sink 50 50 a typ dac ac specifications voltage output settlin g time 15 15 s typ full-scale settling time to within ? lsb of final value digital-to-analog glitch energy 10 10 nvs typ 1 lsb change at major carry reference input/output reference output output voltage (v ref ) 2.5 2.5 v accuracy 2.5 2.5 % max of v ref measured at the c ref pin power supply rejection 47 57 db typ reference tempco 100 100 ppm/oc typ internal v ref power-on time 12 80 80 ms typ external reference input 13 internal band gap reference deselected via adccon2.6 voltage range (v ref ) 14 1.0 1.0 v min v dd v dd v max input impedance 20 20 k? typ input leakage 10 10 a max power supply monitor (psm) v dd trip point selection range 2.63 2.63 v 2.93 2.93 v four trip points selectable in this range 3.08 3.08 v programmed via tp1C0 in psmcon 4.63 v v dd power supply trip point accuracy 3.5 3.5 % max watch dog timer (wdt) 14 timeout period 0 0 ms min nine time -out periods selectable in this range 2000 2000 ms max programmed via pre3C0 in wdcon logic inputs input voltages 14 all inputs except sclock, reset, and xtal1 v inl , input low voltage 0.8 0.4 v max v inh , input high voltage 2.0 2.0 v min
aduc814 rev. a | page 6 of 72 parameter v dd = 5 v v dd = 3 v unit test conditions sclock and reset only 14 (schmitt-triggered inputs) v t+ 1.3 0.95 v min 3.0 2.5 v max v tC 0.8 0.4 v min 1.4 1.1 v max v t+ C v tC 0.3 0.3 v min 0.85 0.85 v max input currents p1.2Cp1.7, dload 10 10 a max v in = 0 v or v dd sclock 15 C10 C3 a min v in = 0 v, internal pull-up C40 C15 a max v in = 0 v, internal pull-up 10 10 a max v in = v dd reset 10 10 a max v in = 0 v 20 10 a min v in = 5 v, 3 v internal pull-down 105 35 a max v in = 5 v, 3 v internal pull-down p1.0, p1.1, port 3 15 10 10 a max v in = 5 v, 3 v (includes miso, mosi/sdata and s s ) 1 1 a typ C180 C70 a min v in = 2 v, v dd = 5 v, 3 v C660 C200 a max C360 C100 a typ C20 C5 a min v in = 450 mv, v dd = 5 v, 3 v C75 C25 a max C38 C12 a typ input capacitance 5 5 pf typ all digital inputs crystal oscillator (xtal1 and xtal2) logic inputs, xtal1 only v inl , input low voltage 0.8 0.4 v typ v inh , input high voltage 3.5 2.5 v typ xtal1 input capacitance 18 18 pf typ xtal2 output capacitance 18 18 pf typ digital outputs output high voltage (v oh ) 2.4 2.4 v min i source = 80 ma output low voltage (v ol ) port 1.0 and port 1.1 0.4 0.4 v max i sink = 10 ma, t max = 85c port 1.0 and port 1.1 0.4 0.4 v max i sink = 10 ma, t max = 125c sclock, miso/mosi 0.4 0.4 v max i sink = 4 ma all other outputs 0.4 0.4 v max i sink = 1.6 ma mcu core clock mcu clock rate 131.1 131.1 khz min clock rate generated via on-chip pll, programmable via cd2-0 in pllcon 16.78 16.78 mhz max start up time at power-on 500 500 ms typ from idle mode 100 100 s typ from power-down mode oscillator running osc_pd = 0 in pllcon sfr wake-up with i n t 0 interrupt 100 100 s typ wake-up with spi/i 2 c interrupt 100 100 s typ wake-up with tic interrupt 100 100 s typ wake-up with external reset 3 3 ms typ
aduc814 rev. a | page 7 of 72 parameter v dd = 5 v v dd = 3 v unit test conditions oscillator powered down 16 osc_pd = 1 in pllcon sfr wake-up with i n t 0 interrupt 150 400 ms typ wake-up with spi/i 2 c interrupt 150 400 ms typ wake-up with external reset 150 400 ms typ after external reset in normal mode 3 3 ms typ after wdt reset in normal mode 3 3 ms typ controlled via wdcon sfr flash/ee memory reliability characteristics 17 endurance 18 100,000 100,000 cycles min data retention 19 100 100 years min power requirements 20, 21 power supply voltages av dd /dv dd C agnd 2.7 v min av dd /dv dd = 3 v nom 3.3 v max 4.5 v min av dd /dv dd = 5 v nom 5.5 v max power supply currents, normal mode d vdd current 14 5 2.5 ma max core clk = 2.097 mhz 4 2 ma typ (cd bits in pllcon = 3) a vdd current 14 1.7 1.7 ma max d vdd current 20 10 ma max core clk = 16.78mhz (max) 16 8 ma typ (cd bits in pllcon = 0) a vdd current 1.7 1.7 ma max d vdd current 14 3.5 1.5 ma max core clk = 131.2 khz (min) 2.8 1.2 ma typ (cd bits in pllcon = 7) a vdd current 1.7 1.7 ma max power supply currents, idle mode d vdd current 14 1.7 1.2 ma max core clk = 2.097 mhz 1.5 1 ma typ (cd bits in pllcon = 3) av dd current 14 0.15 0.15 ma max dv dd current 14 6 3 ma max core clk = 16.78 mhz (max) 4 2.5 ma typ (cd bits in pllcon = 0) av dd current 14 0.15 0.15 ma max dv dd current 14 1.25 1 ma max core clk = 131 khz (min) 1.1 0.7 ma typ (cd bits in pllcon = 7) av dd current 14 0.15 0.15 ma max power supply currents, power-down mode core clk = 2.097 mhz or 16.78 mhz (cd bits in pllcon = 3 or 0) dv dd current 14 20 a max oscillator on 40 14 a typ av dd current 1 1 a typ dv dd current 15 a max oscillator off 20 10 a typ av dd current 1 1 a typ typical additional power supply currents core clk = 2.097 mhz, (cd bits in pllcon = 3) av dd = dv dd = 5 v psm peripheral 50 a typ adc 1.5 ma typ dac 150 a typ
aduc814 rev. a | page 8 of 72 1 temperature range C40oc to +125oc. 2 adc linearity is guaranteed when operating in nonpipelined mode, i.e., adc conversion followed sequentially by a read of the ad c result. adc linearity is also guaranteed during normal micr oconverter core operation. 3 adc lsb size = v ref /2 12 , i.e., for internal v ref = 2.5 v, 1 lsb = 610 v, and for external v ref = 1 v, 1 lsb = 244 v. 4 offset and gain error and offset and gain erro r match are measured after factory calibration. 5 based on external adc system components the user may need to execute a system calibration to remove additional external channel errors and achieve these specifications. 6 measured with coherent sampling system using external 16.77 mhz clock via p3.5 (pin 22). 7 snr calculation includes dist ortion and noise components. 8 channel-to-channel crosstalk is measured on adjacent channels. 9 the temperature monitor gives a measure of the die temperature directly; air temperature can be inferred from this result. 10 dac linearity is calculated using a redu ced code range of 48 to 4095, 0 v to v ref range; a reduced code range of 48 to 3950, 0 v to v dd range. dac output load = 10 k? and 100 pf. 11 dac differential nonlinearity specified on 0 v to v ref and 0 to v dd ranges. 12 measured with v ref and c ref pins decoupled with 0.1 f capacitors to ground. power-up time for the internal reference is determined by the value of the de coupling capacitor chosen for both the v ref and c ref pins. 13 when using an external reference device, the internal band gap reference input can be bypassed by setting the adccon1.6 bit. in this mode, the v ref and c ref pins need to be shorted together for correct operation. 14 these numbers are not production tested but are guaranteed by design and/or characterization data on production release. 15 pins configured in i 2 c compatible mode or spi mode; pins conf igured as digital inpu ts during this test. 16 these typical specifications assume no loading on the xtal2 pin. any additional loading on the xtal2 pin increases the power-on times. 17 flash/ee memory reliabil ity characteristics apply to bo th the flash/ee pro gram memory and the fl ash/ee data memory. 18 endurance is qualified to 100 kcyc les as per jedec std. 22, metho d a117 and measured at C40oc, + 25c, and +125c; typical endur ance at +25c is 700 kcycles. 19 retention lifetime equivalent at junction temperature (t j ) = 55c as per jedec std. 22, metho d a117. retention lifet ime based on an activa tion energy of 0.6 ev derates with junction temp erature as shown in figure 33 in the flash/ee memory desc ription section. 20 power supply current consum ption is measured in normal, id le, and power-down modes unde r the following conditions: normal mode: reset and all digital i/o pins = open circuit, core clk changed via cd bits in pllcon, core executing internal sof tware loop. idle mode: reset and all digital i/o pins = open circuit, core clk changed via cd bits in pllcon, pcon.0 = 1, core execution su spended in idle mode. power-down mode: reset and all p1.2Cp1.7 pins = 0.4 v; all other digital i/o pins are open circuit, core clk changed via cd bit s in pllcon, pcon.1 = 1, core execution suspended in power-down mode, osc turned on or off via osc_pd bit (pllcon.7) in pllcon sfr. 21 dv dd power supply current increases typically by 3 ma (3 v operation) and 10 ma (5 v oper ation) during a flas h/ee memory program or erase cycle.
aduc814 rev. a | page 9 of 72 absolute maximum ratings table 2. temperature = 25c, unless otherwise noted parameter rating av dd to agnd C0.3 v to +7 v dv dd to agnd C0.3 v to +7 v av dd to dv dd C0.3 v to +0.3 v agnd to dgnd 1 C0.3 v to +0.3 v analog input voltage to agnd 2 C0.3 v to av dd + 0.3 v reference input voltage to agnd C0.3 v to av dd + 0.3 v analog input current (indefinite) 30 ma reference input current (indefinite) 30 ma digital input voltage to dgnd C0.3 v to dv dd + 0.3 v digital output voltage to dgnd C0.3 v to dv dd + 0.3 v operating temperature range ?40c to +125c storage temperature range ?65c to +150c junction temperature 150c ja thermal impedance 97.9c/w lead temperature, soldering vapor phase (60 sec) 215c infrared (15 sec) 220c 1 agnd and dgnd are shorted i nternally on the aduc814. 2 applies to pins p1.2 to p1.7 operating in analog or digital input mode. stresses above those listed under absolute maximum ratings may cause permanent damage to the device. this is a stress rating only; functional operation of the device at these or any other conditions above those listed in the operational sections of this specification is not implied. exposure to absolute maximum rating conditions for extended periods may affect device reliability. esd caution esd (electrostatic discharge) sensitive device. electros tatic charges as high as 4000 v readily accumulate on the human body and test equipment and can discharge wi thout detection. although this product features proprietary esd protection circuitry, permanent dama ge may occur on devices subjected to high energy electrostatic discharges. therefore, proper esd precautions are recommended to avoid performance degradation or loss of functionality.
aduc814 rev. a | page 10 of 72 pin configuration and function description aduc814 top view (not to scale) dgnd 1 dload 2 p3.0/rxd 3 p3.1/txd 4 p3.2/int0 5 dv dd xtal2 xtal1 sclock p3.7/sdata/mosi 28 27 26 25 24 p3.3/int1 6 p3.4/t0/convst 7 p1.0/t2 8 p1.1/t2ex 9 p3.6/miso p3.5/t1/ss/extclk p1.7/adc5/dac1 p1.6/adc4/dac0 23 22 21 20 reset 10 p1.5/adc3 19 p1.2/adc0 11 p1.3/adc1 12 av dd 13 agnd 14 p1.4/adc2 c ref v ref agnd 18 17 16 15 02748-a-009 figure 2. pin configuration table 3. pin descriptions pin no. mnemonic type function 1 dgnd s digital ground. ground reference point for the digital circuitry. 2 dload i debug/serial download mode. enables when pulled high through a resistor on power-on or reset. in this mode, dload may also be used as an external emulation i/o pin, therefore the voltage level at this pin must not be changed du ring this mode of operation be cause it may cause an emulation interrupt that halts code execution. user code is ex ecuted when this pin is pulled low on power-on or reset. 3C7 p3.0 C p3.4 i/o bidirectional port pins with intern al pull-up resistors. port 3 pins that have 1s written to them are pulled high by the internal pull-up resistors, and in that state they can be us ed as inputs. as inputs, with port 3 pins being pulled low externally, they source current because of the internal pull-up resistors. when driving a 0-to-1 output transiti on, a strong pull-up is active during s1 of the instruction cycle. port 3 pins also have variou s secondary functions which are described next. 3 p3.0/rxd i/o receiver data input (asynchronous) or data input/output (s ynchronous) in serial (uart) mode. 4 p3.1/txd i/o transmitter data output (asynchronous) or clock output (synchronous ) in serial (uart) mode. 5 p3.2/ int0 i/o interrupt 0, programmable edge or level-triggered in terrupt input, which can be programmed to one of two priority levels. this pin can also be used as agate control input to timer 0. 6 p3.3/ int1 i/o interrupt 1, programmable edge or level-triggered in terrupt input, which can be programmed to one of two priority levels. this pin can also be used as agate control input to timer 1. 7 p3.4/t0/ convst i/o timer/counter 0 input and external tr igger input for adc conversion start. 8C9 p1.0Cp1.1 i/o bidirectional port pins with intern al pull-up resistors. port 1 pins that have 1s written to them are pulled high by the internal pull-up resistors, and in that state they can be us ed as inputs. as inputs ,with port 1 pins being pulled low externally, they source current because of the internal pull-up resistors when driving a 0-to-1 output transition a st rong pull-up is active duri ng s1 of the instruction cycle. port 1 pins also have various secondary functions which are described as follows. 8 p1.0/t2 i/o timer 2 digital input. input to ti mer/counter 2. when enabled, coun ter 2 is incremented in response to a 1 to 0 transition of the t2 input. 9 p1.1/t2ex i/o digital input. cap ture/reload trigger for counter 2. 10 reset i reset input. a high level on this pin while the os cillator is running resets the device. there is an internal weak pull-down and a schmitt- trigger input stage on this pin. 11C12 p1.2Cp1.3 i port 1.2 to p1.3. these pins have no digital output drivers, i.e., they ca n only function as digital inputs, for which 0 must be written to the port bit. these port pins also have the following analog functionality: 11 p1.2/adc0 i adc input channel 0. selected via adccon2 sfr. 12 p1.3/adc1 i adc input channel 1. selected via adccon2 sfr. 13 av dd s analog positive supply voltage, 3 v or 5 v. 14C15 agnd g analog ground. ground refe rence point for the analog circuitry. 16 v ref i/o reference input/output. this pin is connected to the internal refe rence through a switch and is the reference source for the analog to digital converter. the nominal inte rnal reference voltage is 2.5 v and this appears at the pin. this pin can be used to connect an external re ference to the analog to digital converter by setting adccon1.6 to 1. connect 0.1 f between this pin and agnd.
aduc814 rev. a | page 11 of 72 pin no. mnemonic type function 17 c ref i decoupling input for on-chip reference. connect 0.1 f between this pin and agnd. 18C21 p1.4Cp1.7 i port 1.4 to p1.7. these pins have no digital output drivers, i.e., they ca n only function as digital inputs, for which 0 must be written to the port bit. these port pins also have the following analog functionality: 18 p1.4/adc2 i adc input channel 2. selected via adccon2 sfr. 19 p1.5/adc3 i adc input channel 2. selected via adccon2 sfr. 20 p1.6/adc4/ dac0 i/o adc input channel 4. selected via adccon2 sfr. th e voltage dac channel 0 can also be configured to appear on p1.6. 21 p1.7/ adc5/dac1 i/o adc input channel 5, selected via adccon2 sfr. the voltage dac channel 1 can also be configured to appear on p1.7. 22C24 p3.5Cp3.7 i/o bidirectional port pins with intern al pull-up resistors. port 3 pins that have 1s written to them are pulled high by the internal pull-up resistors, and in that state they can be us ed as inputs. as inputs ,with port 3 pins being pulled low externally, they source current because of the internal pull-up resistors. when driving a 0-to-1 output transition a strong pull-up is active during s1 of the instruction cycle. port 3 pins also have various secondary functions which are described as follows. 22 p3.5/t1 i/o timer/counter 1 input. p3.5Cp3.7 pins also have spi interface functions. to enable these functions, bit 0 of the cfg814 sfr must be set to 1. 22 p3.5/ ss /extclk i/o this pin also functions as the slave select input fo r the spi interface when the device is operated in slave mode. p3.5 can also function as an input for an external clock. this clock effectively bypasses the pll. this function is enabled by setting bit 1 of the cfg814 sfr. 23 p3.6/miso i/o spi master input/sl ave output data in put/output pin. 24 p3.7/sdata/ mosi i/o spi master output/slave in put data inp ut/output pin. 25 sclock i/o serial clock pin for spi serial interface clock. 26 xtal1 i input to the crystal oscillator inverter. 27 xtal2 o output from the crystal oscillator inverter. 28 dv dd s analog positive supply voltage, 3 v or 5 v. i = input, o = output, s = supply, g - ground. the following notes apply to the entire data sheet: ? in bit designation tables, set implies a logic 1 state, and cleared implies a logic 0 state, unless otherwise stated. ? set and cleared also imply that the bit is set or cleared by the aduc814 hardware, unless otherwise stated. ? user software should not write to reserved or unimplemented bits as they may be used in future products.
aduc814 rev. a | page 12 of 72 terminology adc specifications integral nonlinearity this is the maximum deviation of any code from a straight line passing through the endpoints of the adc transfer function. the endpoints of the transfer function are zero scale, a point1/2 lsb below the first code transition and full scale, a point 1/2 lsb above the last code transition. differential nonlinearity this is the difference between the measured and the ideal 1 lsb change between any two adjacent codes in the adc. offset error this is the deviation of the first code transition (0000 000) to (0000 001) from the ideal, i.e., +1/2 lsb. full-scale error this is the deviation of the last code transition from the ideal ain voltage (full-scale error has been adjusted out). signal-to-(noise + distortion) ratio this is the measured ratio of signal-to-(noise + distortion) at the output of the adc. the signal is the rms amplitude of the fundamental. noise is the rms sum of all nonfundamental signals up to half the sampling frequency (f s /2), excluding dc. the ratio is dependent upon the number of quantization levels in the digitization process; the more levels, the smaller the quantization noise. the theoretical signal-to-(noise + distortion) ratio for an ideal n-bit converter with a sine wave input is given by signal-to =- (noise + distortion) = (6.02n + 1.76) thus, for a 12-bit converter, this is 74 db. total harmonic distortion (thd) total harmonic distortion is the ratio of the rms sum of the harmonics to the fundamental. peak harmonic or spurious noise peak harmonic or spurious noise is defined as the ratio of the rms value of the next largest component in the adc output spectrum (up to f s /2 and including dc) to the rms value of the fundamental. normally, the value of this specification is determined by the largest harmonic in the spectrum, but for adcs where the harmonics are buried in the noise floor, it is the noise peak. dac specifications relative accuracy relative accuracy or endpoint linearity is a measure of the maximum deviation from a straight line passing through the endpoints of the dac transfer function. it is measured after adjusting for zero-scale error and full-scale error. voltage output settling time this is the amount of time it takes for the output to settle to a specified level for a full-scale input change. digital-to-analog glitch impulse this is the amount of charge injected into the analog output when the inputs change state. it is specified as the area of the glitch in nv-sec.
aduc814 rev. a | page 13 of 72 typical performance curves the typical performance plots presented in this section illustrate typical performance of the aduc814 under various operating conditions. note that all typical plots in this section were generated using the aduc814bru, i.e., the b-grade part. figure 3 and figure 4 show typical adc integral nonlinearity (inl) errors from adc code 0 to code 4095 at 5 v and 3 v supplies, respectively. the adc is using its internal reference (2.5 v) and operating at a sampling rate of 152 khz. the typical worst-case errors in both plots are just less than 0.3 lsbs. adc codes lsbs 0 ?0.4 ?0.3 ?0.2 ?0.1 0 0.1 0.4 0.3 0.2 1023 511 3583 3071 2559 2047 1535 4095 02748-a-010 av dd /dv dd = 5v f s = 152khz figure 3. typical inl error, v dd = 5 v adc codes lsbs 0 ?0.4 ?0.3 ?0.2 ?0.1 0 0.1 0.4 0.3 0.2 1023 511 3583 3071 2559 2047 1535 4095 02748-a-011 av dd /dv dd = 3v f s = 152khz figure 4. typical inl error, v dd = 3 v figure 5 and figure 6 show the variation in worst-case positive (wcp) inl and worst-case ne gative (wcn) inl versus external reference input voltage. external reference (v) 1.2 wcp?inl (lsbs) 0.8 0.4 0 ?0.4 ?0.6 1.0 0.6 0.2 ?0.2 av dd /dv dd = 5v f s = 152khz 0.5 1.0 1.5 2.0 2.5 5.0 0.6 0.4 0 ?0.4 ?0.6 0.2 ?0.2 wcn?inl (lsbs) wcn inl wcp inl 02748-a-012 figure 5. typical worst-case inl error vs. v ref , v dd = 5 v external reference (v) wcp?inl (lsbs) 0.8 0.4 0 ?0.4 ?0.8 0.6 0.2 ?0.2 av dd /dv dd = 3v f s = 152khz 0.5 1.5 2.5 wcn?inl (lsbs) ?0.6 0.8 0.4 0 ?0.4 ?0.8 0.6 0.2 ?0.2 ?0.6 3.0 2.0 1.0 wcn inl wcp inl 02748-a-013 figure 6. typical worst-case inl error vs. v ref , v dd = 3 v figure 7 and figure 8 show typical adc differential nonlinearity (dnl) errors from adc code 0 to code 4095 at 5 v and 3 v supplies, respectively. the adc is using its internal reference (2.5 v) and operating at a sampling rate of 152 khz. the typical worst-case errors in both plots are just less than 0.2 lsbs.
aduc814 rev. a | page 14 of 72 adc codes lsbs 0 ?0.25 ?0.20 ?0.15 ?0.10 ?0.50 0 0.05 0.10 0.30 0.25 0.20 0.15 1023 511 3583 3071 2559 2047 1535 4095 02748-a-014 av dd /dv dd = 5v f s = 152khz figure 7. typical dnl error, v dd = 5 v adc codes lsbs 0 ?0.25 ?0.20 ?0.15 ?0.10 ?0.50 0 0.05 0.10 0.30 0.25 0.20 0.15 1023 511 3583 3071 2559 2047 1535 4095 02748-a-015 av dd /dv dd = 3v f s = 152khz figure 8. typical dnl error, v dd = 3 v figure 9 and figure 10 show the variation in worst-case positive (wcp) dnl and worst-case negative (wcn) dnl versus external reference input voltage. external reference (v) ?0.6 0.5 wcp?dnl (lsbs) 1.0 2.0 2.5 5.0 ?0.4 1.5 ?0.2 0 0.2 0.4 0.6 wcn?dnl (lsbs) ?0.4 ?0.6 ?0.2 0 0.2 0.4 0.6 av dd /dv dd = 5v f s = 152khz wcp dnl wcn dnl 02748-a-016 figure 9. typical worst-case dnl error vs. v ref , v dd = 5 v external reference (v) wcp?dnl (lsbs) 0.7 0.5 0.1 ?0.5 ?0.7 0.3 ?0.3 av dd /dv dd = 3v f s = 152khz 0.5 1.0 1.5 2.0 2.5 3.0 wcn?dnl (lsbs) wcp dnl wcn dnl ?0.1 0.7 0.5 0.1 ?0.5 ?0.7 0.3 ?0.3 ?0.1 02748-a-017 figure 10. typical worst-case dnl error vs. v ref , v dd = 3 v figure 11 shows a histogram plot of 10,000 adc conversion results on a dc input with v dd = 5 v. the plot illustrates an excellent code distribution pointing to the low noise performance of the on-chip precision adc. code 817 818 819 820 821 10000 occurrence 8000 6000 4000 2000 0 02748-a-018 figure 11. code histogram plot, v dd = 5 v figure 12 shows a histogram plot of 10,000 adc conversion results on a dc input for v dd = 3 v. the plot again illustrates a very tight code distribution of 1 lsb with the majority of codes appearing in one output bin. code 10000 817 818 819 820 821 occurrence 8000 6000 4000 2000 0 9000 7000 5000 3000 1000 02748-a-019 figure 12. code histogram plot, v dd = 3 v
aduc814 rev. a | page 15 of 72 figure 13 and figure 14 show typical fft plots for the aduc814. these plots were generated using an external clock input via p3.5 to achieve coherent sampling. the adc is using its internal reference (2.5 v) sampling a full-scale, 10 khz sine wave test tone input at a sampling rate of 149.79 khz. the resultant ffts shown at 5 v and 3 v supplies illustrate an excellent 100 db noise floor, a 71 db signal-to-noise ratio (snr), and a thd greater than ?80 db. 20 0 ?20 ?40 ?60 ?80 ?100 ?120 ?140 ?160 dbs 20 frequency (khz) 10 070 60 50 40 30 02748-a-020 av dd /dv dd = 5v f s = 149.79khz f in = 9.910khz snr = 71.3db thd = ?88.0db enob = 11.6 figure 13. aduc814 dynamic performance at v dd = 5 v 20 0 ?20 ?40 ?60 ?80 ?100 ?120 ?140 ?160 dbs 20 frequency (khz) 10 070 60 50 40 30 02748-a-021 av dd /dv dd = 3v f s = 149.79khz f in = 9.910khz snr = 71.3db thd = ?88.0db enob = 11.6 figure 14. aduc814 dynamic performance at v dd = 3 v figure 15 and figure 16 show typical dynamic performance versus external reference voltages. again excellent ac performance can be observed in both plots with some roll-off being observed as v ref falls below 1 v. external reference (v) 50 0.5 snr (dbs) 1.0 2.0 2.5 5.0 55 1.5 60 65 70 75 80 thd (dbs) ?100 ?95 ?90 ?85 ?80 ?75 ?70 av dd /dv dd = 5v f s = 152khz snr thd 02748-a-022 figure 15. typical dynamic performance vs. v ref , v dd = 5 v external reference (v) snr (dbs) 80 75 65 50 70 55 av dd /dv dd = 3v f s = 152khz 0.5 1.5 2.5 thd (dbs) snr thd 60 ?70 ?75 ?85 ?100 ?80 ?95 ?90 1.0 2.0 3.0 02748-a-023 figure 16. typical dynamic performance vs. v ref , v dd = 3 v
aduc814 rev. a | page 16 of 72 aduc814 architecture, main features the aduc814 is a fully integrated 247 ksps 12-bit data acquisition system incorporating a high performance multi- channel adc, an 8-bit mcu, and program/data flash/ee memory on a single chip. this low power device operates from a 32 khz crystal with an on-chip pll generating a high frequency clock of 16.78 mhz. this clock is, in turn, routed through a programmable clock divider from which the mcu core clock operating frequency is generated. the microcontroller core is an 8052, and therefore 8051, instruction set compatible. the microcontroller core machine cycle consists of 12 core clock periods of the selected core operating frequency. eight kbytes of nonvolatile flash/ee program memory are provided on-chip. 640 bytes of nonvolatile flash/ee data memory and 256 bytes ram are also integrated on-chip. the aduc814 also incorporates additional analog functionality with dual 12-bit dacs, a power supply monitor, and a band gap reference. on-chip digital peripherals include a watchdog timer, time interval counter, three timer/counters, and three serial i/o ports (spi, uart, i 2 c). on-chip factory firmware supports in-circuit serial download and debug modes (via uart), as well as single-pin emulation mode via the dload pin. a detailed functional block diagram of the aduc814 is shown in figure 17. the aduc814 is supported by a quickstart development system. this is a full-featured, low cost system, consisting of pc-based (windows compatible) hardware and software development tools. the part operates from a single 3 v or 5 v supply. when operating from 3 v supplies, the power dissipation for the part is below 10 mw. the aduc814 is housed in a 28-lead tssop package and is specified for operation over an extended temperature range ?40c to +125c. d g n d s c l o c k / d 0 aduc814 buf p 1 . 0 ( t 2 ) p 1 . 1 ( t 2 e x ) p 1 . 2 ( a i n 0 ) p 1 . 4 ( a i n 2 ) p 1 . 5 ( a i n 3 ) p 1 . 6 ( a i n 4 / d a c 0 ) p 1 . 7 ( a i n 5 / d a c 1 ) p 3 . 0 ( r x d ) p 3 . 1 ( t x d ) p 3 . 2 ( i n t 0 ) p 1 . 3 ( a i n 1 ) buf t0 t1 t2ex t2 dac1 dac0 m o s i / d 1 por p 3 . 3 ( i n t 1 ) p 3 . 4 ( t 0 ) p 3 . 5 ( s s / e x t c l k ) p 3 . 6 ( m i s o ) p 3 . 7 ( m o s i / d 1 ) dac1 dac0 buf int0 int1 xtal1 xtal2 miso ss dload txd rxd reset dv dd agnd av dd agnd 8052 mcu core c ref v ref temp monitor dac0 dac1 v ref agnd band gap reference 640 8 data flash/ee 256 8 user ram watchdog timer 16-bit counter timers time interval counter prog. clock divider osc and pll spi serial interface downloader debugger single-pin emulator asynchronous serial port (uart) power supply monitor 8k 8 program flash/ee 12-bit adc adc control and cal logic dac control logic ain mux t/h adc5 adc0 d0 d1 11 21 16 17 02748-a-024 figure 17. aduc814 block diagram
aduc814 rev. a | page 17 of 72 memory organization the aduc814 does not have port 0 and port 2 pins and therefore does not support external program or data memory interfaces. the device executes code from the internal 8-kbyte flash/ee program memory. this internal code space can be programmed via the uart serial port interface while the device is in-circuit. the program memory space of the aduc814 is shown in figure 18. 1fffh 0000h internal 8 kbyte flash/ee program memory program memory space read-only 02748-a-025 figure 18. program memory map the data memory address space consists of internal memory only. the internal memory space is divided into four physically separate and distinct blocks, namely the lower 128 bytes of ram, the upper 128 bytes of ram, the 128 bytes of special function register (sfr) area, and a 640-byte flash/ee data memory. while the upper 128 bytes of ram and the sfr area share the same address locations, they are accessed through different addressing modes. the lower 128 bytes of data memory can be accessed through direct or indirect addressing, the upper 128 bytes of ram can be accessed through indirect addressing, and the sfr area is accessed through direct addressing. also, as shown in figure 19, an additional 640 bytes of flash/ee data memory are available to the user and can be accessed indirectly via a group of control registers mapped into the sfr area. access to the flash/ee data memory is discussed in detail later as part of the flash/ee memory section. special function registers accessible by direct addressing only 640 bytes flash/ee data memory accessed indirectly via sfr control registers internal data memory space accessible by indirect addressing only accessible by direct and indirect addressing ffh 80h 7fh 00h upper 128 lower 128 ffh 80h data memory space read/write (page 159) (page 0) 00h 9fh 02748-a-026 figure 19. data memory map the lower 128 bytes of internal data memory are mapped as shown in figure 20. the lowest 32 bytes are grouped into four banks of eight registers addressed as r0 to r7. the next 16 bytes (128 bits), locations 20h to 2fh above the register banks, form a block of directly addressable bit locations at bit addresses 00h through 7fh. the stack can be located anywhere in the internal memory address space, and the stack depth can be expanded up to 256 bytes. 11 10 01 00 07h 0fh 17h 1fh 2fh 7fh 00h 08h 10h 18h 20h reset value of stack pointer 30h four banks of eight registers r0 r7 bit-addressable bit addresses general-purpose area banks selected via bits in psw 02748-a-027 figure 20. lower 128 bytes of internal data memory reset initializes the stack pointer to location 07h and incre- ments it once to start from location 08h, which is also the first register (r0) of register bank 1. if more than one register bank is being used, the stack pointer should be initialized to an area of ram not used for data storage.
aduc814 rev. a | page 18 of 72 the sfr space is mapped to the upper 128 bytes of internal data memory space and is accessed by direct addressing only. it provides an interface between the cpu and all on-chip periph- erals. a block diagram showing the programming model of the aduc814 via the sfr area is shown in figure 21. a complete sfr map is shown in figure 22. other on-chip peripherals temperature monitor dual 12-bit dac serial i/o wdt psm tic pll 6-channel 12-bit sar adc 02748-a-028 640-byte electrically reprogrammable nonvolatile flash/ee data memory 8-kbyte electrically reprogrammable nonvolatile flash/ee program memory 8051 compatible core 256 bytes ram 128-byte special function register area figure 21. programming model overview of mcu-related sfrs accumulator sfr acc is the accumulator register and is used for math operations including addition, subtraction, integer multiplication and division, and boolean bit manipulations. the mnemonics for accumulator-specific instructions refer to the accumulator as a. b sfr the b register is used with the acc for multiplication and division operations. for other instructions it can be treated as a general-purpose scratchpad register. stack pointer sfr the sp register is the stack pointer and is used to hold an internal ram address called the top of the stack . the sp register is incremented before data is stored during push and call executions. while the stack may reside anywhere in on-chip ram, the sp register is initialized to 07h after a reset. this causes the stack to begin at location 08h. data pointer the data pointer is made up of two 8-bit registers, named dph (high byte) and dpl (low byte). these registers provide memory addresses for internal code access. the pointer may be manipu- lated as a 16-bit register (dptr = dph, dpl), or as two inde- pendent 8-bit registers (dph, dpl). program status word sfr the program status word (psw) register is the program status word that contains several bits reflecting the current status of t he cpu as detailed in table 4. sfr address d0h power-on default 00h bit addressable yes cy ac f0 rs1 rs0 ov f1 p table 4. psw sfr bit designations bit no. name description 7 cy carry flag. 6 ac auxiliary carry flag. 5 f0 general-purpose flag. 4 rs1 register bank select bits. 3 rs0 rs1 rs0 selected bank 0 0 0 0 1 1 1 0 2 1 1 3 2 ov overflow flag. 1 f1 general-purpose flag. 0 p parity bit.
aduc814 rev. a | page 19 of 72 power control sfr the power control (pcon) register contains bits for power-saving options and general-purpose status flags as shown in table 5. sfr address 87h power-on default 00h bit addressable no smod seripd int0pd --- gf1 gf0 pd idl table 5. pcon sfr bit designations bit no. name description 7 smod double uart baud rate. 6 seripd spi power-down interrupt enable. 5 int0pd int0 power-down interrupt enable. 4 rsvd reserved. 3 gf1 general-purpose flag bit. 2 gf0 general-purpose flag bit. 1 pd power-down mode enable. 0 idl idle mode enable.
aduc814 rev. a | page 20 of 72 special function registers all registers, except the program counter and the four general- purpose register banks, reside in the sfr area. the sfr registers include control, configuration, and data registers that provide an interface between the cpu and all on-chip peripherals. figure 22 shows a full sfr memory map and sfr contents on reset; not used indicates unoccupied sfr locations. unoccupied locations in the sfr address space are not implemented, i.e., no register exists at this location. if an unoccupied location is read, an unspecified value is returned. sfr locations reserved for future use are shaded (reserved) and should not be accessed by the user software. reserved reserved not used reserved reserved reserved reserved reserved reserved reserved reserved not used not used not used not used reserved spicon 1 f8h 04h dac0l f9h 00h dac0h fah 00h dac1l fbh 00h dac1h fch 00h daccon fdh 04h reserved b 1 f0h 00h adcofsl f1h 00h adcofsh f2h 20h adcgainl f3h 00h adcgainh f4h 00h adccon3 f5h 00h reserved dcon 1 e8h 00h reserved acc 1 e0h 00h reserved adccon2 1 d8h 00h adcdatal d9h 00h adcdatah dah 00h reserved psw 1 d0h 00h reserved t2con 1 c8h 00h rcap2l cah 00h rcap2h cbh 00h tl2 cch 00h th2 cdh 00h reserved wdcon 1 c0h 10h chipid c2h 0xh ip 1 b8h 00h econ b9h 00h edata1 bch 00h etim2 bbh 00h etim1 bah 00h edata2 bdh 00h ie 1 a8h 00h ieip2 a9h a0h scon 1 98h 00h i2cdat 9ah 00h i2cadd 9bh 55h sbuf 99h 00h not used not used p1 1,2 90h ffh not used tcon 1 88h 00h tmod 89h 00h tl0 8ah 00h tl1 8bh 00h th0 8ch 00h th1 8dh 00h sp 81h 07h dpl 82h 00h dph 83h 00h reserved reserved reserved reserved reserved reserved reserved reserved reserved reserved reserved reserved reserved reserved reserved reserved reserved reserved not used p3 1 b0h ffh not used not used not used not used not used spidat f7h 00h adccon1 efh 00h reserved psmcon dfh deh edarl c6h 00h edata3 beh 00h edata4 bfh 00h not used pcon 87h 00h ispi ffh 0 wcol feh 0 spe fdh 0 spim fch 0 cpol fbh 0 cpha fah spr1 f9h 0 spr0 5 f8h 0 bits f7h 0 f6h 0 f5h 0 f4h 0 f3h 0 f2h f1h 0 f0h 0 bits d1 efh 0 eeh 0 d0 edh 0 ech 0 ebh 0 eah e9h 0 e8h 0 bits e7h 0 e6h 0 e5h 0 e4h 0 e3h 0 e2h e1h 0 e0h 0 bits adci dfh 0 adcspi deh 0 cconv ddh 0 sconv dch 0 cs3 dbh 0 cs2 dah cs1 d9h 0 cs0 d8h 0 bits cy d7h 0 ac d6h 0 f0 d5h 0 rs1 d4h 0 rs0 d3h 0 ov d2h fi d1h 0 p d0h 0 bits tf2 cfh 0 exf2 ceh 0 rclk cdh 0 tclk cch 0 exen2 cbh 0 tr2 cah cnt2 c9h 0 cap2 c8h 0 bits pre3 c7h 0 pre2 c6h 0 pre1 c5h 0 c4h 1 wdir c3h 0 wds c2h wd c1h 0 wdwr c0h 0 bits psi bfh 0 padc beh 0 pt2 bdh 0 ps bch 0 pt1 bbh 0 px1 bah pt0 b9h 0 px0 b8h 0 bits rd b7h 1 wr b6h 1 t1 b5h 1 t0 b4h 1 int1 b3h 1 int0 b2h txd b1h 1 rxd b0h 1 bits ea afh eadc aeh et2 adh es ach 0 et1 abh 0 ex1 aah et0 a9h 0 ex0 a8h 0 bits sm0 9fh 0 sm1 9eh 0 sm2 9dh 0 ren 9ch 0 tb8 9bh 0 rb8 9ah ti 99h 0 ri 98h 0 bits 97h 1 96h 1 95h 1 94h 1 93h 1 92h t2ex 91h 1 t2 90h 1 bits tf1 8fh 0 tr1 8eh 0 tf0 8dh 0 tr0 8ch 0 ie1 8bh 0 it1 8ah ie0 89h 0 it0 88h 0 bits 1 0 1 0 ie0 89h 0 it0 88h 0 tcon 88h 00h mnemonic sfr address default value mnemonic default value sfr address these bits are contained in this byte. sfr map key: 1 reserved reserved reserved 0 0 0 0 0 0 0 0 0 0 00 timecon hthsec sec min hour intval a1h a2h a3h a4h a5h a6h 00h 00h 00h 00h 00h 00h reserved reserved reserved reserved reserved reserved reserved cfg814 9ch 04h reserved reserved d1en d0en reserved pre0 pllcon d7h 53h 02748-0-029 figure 22. special function register locations and reset values note the following about sfrs: ? sfrs whose address ends in 0h or 8h are bit addressable. ? only p1.0 and p1.1 can operate as digital i/o pins. p1.2Cp1.7 can be configured as analog inputs (adc inputs) or as digital inp uts. ? the chipid sfr contains the silicon revision id byte and may change for future silicon revisions. ? these registers are reconfigured at power-on with factory calculated calibration coefficients that can be overwritten by user c ode. see the calibration options in adccon3 sfr. ? when the spim bit in the spicon sfr is cleared, the spr0 bit reflects the level on the ss pin (pin 22).
aduc814 rev. a | page 21 of 72 adc circuit information general overview the adc block incorporates a 4.05 msec, 6-channel, 12-bit resolution, single-supply adc. this block provides the user with a multichannel multiplexer, track-and-hold amplifier, on- chip reference, offset calibration features and adc. all compo- nents in this block are easily configured via a 3-register sfr interface. the adc consists of a conventional successive-approximation converter based around a capacitor dac. the converter accepts an analog input range of 0 v to v ref . a precision, factory cali- brated 2.5 v reference is provided on-chip. an external reference may also be used via the external v ref pin. this external refer- ence can be in the range 1.0 v to av dd . single or continuous conversion modes can be initiated in software. in hardware, a convert signal can be applied to an external pin (convst), or alternatively timer 2 can be config- ured to generate a repetitive trigger for adc conversions. the aduc814 has a high speed adc to spi interface data capture logic implemented on-chip. once configured, this logic transfers the adc data to the spi interface without the need for cpu intervention. the adc has six external input channels. two of the adc channels are multiplexed with the dac outputs, adc4 with dac0, and adc5 with dac1. when the dac outputs are in use, any adc conversion on these channels represents the dac output voltage. due care must be taken to ensure that no external signal is trying to drive these adc/dac channels while the dac outputs are enabled. in addition to the six external channels of the adc, five internal signals are also routed through the front end multiplexer. these signals include a temperature monitor, dac0, dac1, v ref , and agnd. the temperature monitor is a voltage output from an on-chip band gap reference, which is proportional to absolute temperature. these internal channels can be selected similarly to the external channels via cs3Ccs0 bits in the adccon2 sfr. the aduc814 is shipped with factory programmed offset and gain calibration coefficients that are automatically downloaded to the adc on a power-on or reset event, ensuring optimum adc performance. the adc core contains automatic endpoint self-calibration and system calibration options that allow the user to overwrite the factory programmed coefficients if desired and tailor the adc transfer function to the system in which it is being used. adc transfer function the analog input range for the adc is 0 v to v ref . for this range, the designed code transitions occur midway between successive integer lsb values, i.e., 1/2 lsb, 3/2 lsbs, 5/2 lsbs . . . fs C3/2 lsbs. the output coding is straight binary with 1 lsb = fs/4096 or 2.5 v/4096 = 0.61 mv when v ref = 2.5 v. the ideal input/output transfer characteristic for the 0 v to v ref range is shown in figure 23. output code 111...111 111...110 111...101 111...100 000...011 000...010 000...001 000...000 0v 1lsb voltage input +fs 1lsb = fs 4096 02748-a-030 figure 23. aduc814 adc transfer function adc data output format once configured via the adccon1C3 sfrs, the adc converts the analog input and provides an adc 12-bit result word in the adcdatah/l sfrs. the adcdatal sfr contains the bottom 8 bits of the 12-bit result. the bottom nibble of the adcdatah sfr contains the top 4 bits of the result, while the top nibble contains the channel id of the adc channel which has been converted on. this id corresponds to the channel selection bits cd3Ccd0 in the adccon2 sfr. the format of the adc 12-bit result word is shown in figure 24. ch?id top 4 bits high 4 bits of adc result word low 8 bits of the adc result word adcdatah sfr adcdatal sfr 02748-a-031 figure 24. adc result format
aduc814 rev. a | page 22 of 72 sfr interface to adc block the adc operation is fully controlled via three sfrs: adccon1, adccon2, and adccon3. these three registers control the mode of operation. adccon1 (adc control sfr 1) the adccon1 register controls conversion and acquisition times, hardware conversion modes, and power-down modes as detailed below. sfr address efh sfr power-on default 00h bit addressable no mode ext_ref ck1 ck0 aq1 aq0 t2c exc table 6. adccon1 sfr bit designations bit no. name description 7 mode mode bit. this bit selects the operating mode of the adc. set to 1 by the user to power on the adc. set to 0 by the user to power down the adc. 6 ext_ref external reference select bit. this bit selects which reference the adc uses when performing a conversion. set to 1 by the user to switc h in an external reference. set to 0 by the user to switch in the on-chip band gap reference. 5 ck1 adc clock divide bits. 4 ck0 ck1 and ck0 combine to select the divide ratio for the pll master clock used to generate the adc clock. to ensure correct adc operation, the divider ratio must be chosen to reduce the adc clock to 4.5 mhz and below. the divider ratio is selected as follows: ck1 ck0 pll divider 0 0 8 0 1 4 1 0 16 1 1 32 3 aq1 the adc acquisition time select bits. 2 aq0 aq1 and aq0 combine to select the nu mber of adc clocks required for th e input track-and-hold amplifier to acquire the input signal. the acquisit ion time is selected as follows: aq1 aq0 no. adc clks 0 0 1 0 1 2 1 0 3 1 1 4 1 t2c the timer2 conversion bit. t2c is set to enable the timer2 overflow bit to be used as the adc convert start trigger input. 0 exc the external trigger enable bit. exc is set to allow the external convst pin be used as the active low convert start trigger input. when enabled, a rising edge on this input pin trigger a conversion. th is pin should remain low for a minimum pulse width of 100 nsec at the required sample rate.
aduc814 rev. a | page 23 of 72 adccon2 (adc control sfr 2) the adccon2 (byte addressable) register controls adc chan nel selection and conversion modes as detailed below. sfr address d8h sfr power-on default 00h bit addressable yes adci adcspi cconv scovc cs3 cs2 cs1 cs0 table 7. adccon2 sfr bit designations bit no. name description 7 adci adc interrupt bit. adci is set at the end of a single adc conversion cycle. if the adc interrupt is enabled, the adci bit is cleared when user code vectors to the adc interru pt routine. otherwise the adci bit sh ould be cleared by the user code. 6 adcspi adcspi mode enable bit. adcspi is set to enable the adc conversi on results to be transferred directly to the spi data buffer (spidat) without intervention from the cpu. 5 cconv continuous conversion bit. cconv is set to initiate the adc into a continuous mode of conversion. in this mode the adc starts converting based on the timing and channel configuration already se t up in the adccon sfrs. th e adc automatically starts another conversion once a previous conversion cycle ha s completed. when operating in this mode from 3 v supplies, the adc should be configured for adc clock di vide of 16 using ck1 and ck 0 bits in adccon1, and adc acquisition time should be set to four adc clocks using aq1, aq0 bits in adccon1 sfr. 4 sconv single conversion bit. sconv is set to initiate a single conversion cycle. the sc onv bit is automatically reset to 0 on completion of the single conversion cycle. when operating in this mode from 3 v supplies, the maximum adc sampling rate should not exceed 147 ksps. 3 cs3 channel selection bits. 2 1 cs2 cs1 cs3Ccs0 allow the user to program the adc channel selection under software control. once a conversion is initiated, the channel converted is point ed to by these channel selection bits. 0 cs0 the channel select bits operate as follows: cs3 cs2 cs1 cs0 channel 0 0 0 0 0 0 0 0 1 1 0 0 1 0 2 0 0 1 1 3 0 1 0 0 4 0 1 0 1 5 0 1 1 0 x not a vaild selection. no adc channel selected. 0 1 1 1 x not a valid selection. no adc channel selected. 1 0 0 0 temperature sensor 1 0 0 1 dac0 1 0 1 0 dac1 1 0 1 1 agnd 1 1 0 0 v ref
aduc814 rev. a | page 24 of 72 adccon3 (adc control sfr 3) the adccon3 register controls the operation of various calibration modes as well as giving an indication of adc busy status. sfr address f5h sfr power-on default 00h busy gncld avgs1 avgs0 ofcld modcal typecal scal table 8. adccon3 sfr bit designations bit no. name description 7 busy adc busy status bit. busy is a read-only status bit that is set during a valid adc conversion or calibration cycle. busy is automatically cleared by the core at the end of a conversion or calibration cycle. 6 gncld gain calibration disable bit. this bit enables/disables the gain calibration coefficients from affecting the adc results. set to 0 to enable gain calibration coefficient set to 1 to disable gain calibration coefficient. 5 avgs1 number of averages selection bits. 4 avgs0 this bit selects the number of adc readings averaged for each bit decision during a calibration cycle. avgs1 avgs0 number of averages 0 0 15 0 1 1 1 0 31 1 1 63 3 ofcld offset calibration disable bit. this bit enables/disables the offset calibration coefficients from affecting the adc results. set to 0 to enable offset calibration coefficient. set to 1 to disable the offs et calibration coefficient 2 modcal calibration mode select bit. this bit should be set to 1 for all calibration cycles. 1 typecal calibration type select bit. this bit selects between offset (zero-scale) and gain (full-scale) calibration. set to 0 for offset calibration. set to 1 for gain calibration. 0 scal start calibration cycle bit. when set, this bit starts the selected calibration cycle. it is automatically clea red when the calibration cycle is completed.
aduc814 rev. a | page 25 of 72 driving the adc the adc incorporates a successive approximation architecture (sar) involving a charge-sampled input stage. each adc con- version is divided into two distinct phases as defined by the position of the switches in figure 25. during the sampling phase (with sw1 and sw2 in the track position), a charge proportional to the voltage on the analog input is developed across the input sampling capacitor. during the conversion phase (with both switches in the hold position), the capacitor dac is adjusted via internal sar logic until the voltage on node a is zero, indicating that the sampled charge on the input capacitor is balanced out by the charge being output by the capacitor dac. the digital value finally contained in the sar is then latched out as the result of the adc conversion. control of the sar, and timing of acquisition and sampling modes, is han- dled automatically by built-in adc control logic. acquisition and conversion times are also fully configurable under user control. comparator v ref agnd dac1 dac0 temperature monitor internal channels ain5 ain0 32pf agnd aduc814 track track hold hold 200 ? 200 ? 02748-a-032 capacitor dac figure 25. internal adc structure note that whenever a new input channel is selected, a residual charge from the 32 pf sampling capacitor places a transient on the newly selected input. the signal source must be capable of recovering from this transient before the sampling switches click into hold mode. delays can be inserted in software (between channel selection and conversion request) to account for input stage settling, but a hardware solution alleviates this burden from the software design task and ultimately results in a cleaner system implementation. one hardware solution is to choose a very fast settling op amp to drive each analog input. such an op amp would need to fully settle from a small signal transi ent in less than 300 ns in order to guarantee adequate settling under all software configurations. a better solution, recommended for use with any amplifier, is shown in figure 26. ain0 aduc814 10 ? 0.1 f 02748-a-033 figure 26. buffering analog inputs at first glance the circuit in figure 26 may look like a simple anti-aliasing filter, it actually serves no such purpose. though the r/c does help to reject some incoming high frequency noise, its primary function is to ensure that the transient demands of the adc input stage are met. it does so by providing a capacitive bank from which the 32 pf sampling capacitor can draw its charge. since the 0.1 f capacitor in figure 26 is more than 3000 times the size of the 32 pf sampling capacitor, its voltage does not change by more than one count of the 12-bit transfer function when the 32 pf charge from a previous channel is dumped onto it. a larger capacitor can be used if desired, but care needs to be taken if choosing a larger resistor (see table 9). the schottky diodes in figure 26 may be necessary to limit the voltage applied to the analog input pin as per the absolute maximum ratings. they are not necessary if the op amp is powered from the same supply as the aduc814 because, in that case, the op amp is unable to generate voltages above v dd or below ground. an op amp of some kind is necessary unless the signal source is very low impedance to begin with. dc leakage currents at the aduc814 analog inputs can cause measurable dc errors with external source impedances as little as 100 ? or so. to ensure accurate adc operation, keep the total source impedance at each analog input less than 61 ?. table 9 illustrates examples of how source impedance can affect dc accuracy. table 9. source impedance errors source impedance error from 1 a leakage current error from 10 a leakage current 61 ? 61 v = 0.1 lsb 610 v = 1 lsb 610 ? 610 v = 1 lsb 6.1 mv = 10 lsb although figure 26 shows the op amp operating at a gain of 1, you can configure it for any gain needed. also, you can just as easily use an instrumentation amplifier in its place to condition differential signals. use any modern amplifier that is capable of delivering the signal (0 v to v ref ) with minimal saturation. some single-supply, rail-to-rail op-amps that are useful for this purpose include, but are certainly not limited to, the ones given in table 10. check the analog de vices literature (cd rom data book, etc.) for details on these and other op amps and instrumentation amps.
aduc814 rev. a | page 26 of 72 table 10. some single-supply op amps op amp model characteristics op281/op481 micropower op191/op291/op491 i/o good up to v dd , low cost op196/op296/op496 i/o to v dd , micropower, low cost op183/op283 high gain-bandwidth product op162/op262/op462 high gbp, micropackage ad820/op822/op824 fet input, low cost ad823 fet input, high gbp keep in mind that the adcs transfer function is 0 v to v ref , and any signal range lost to amplifier saturation near ground impacts dynamic range. though the op amps in table 10 are capable of delivering output signals very closely approaching ground, no amplifier can deliver signals all the way to ground when powered by a single supply. therefore, if a negative supply is available, one could consider using it to power the front end amplifiers. if you do, however, be sure to include the schottky diodes shown in figure 26 (or at least the lower of the two diodes) to protect the analog input from undervoltage conditions. voltage reference connections the on-chip 2.5 v band gap voltage reference can be used as the reference source for the adc and dacs. to ensure the accuracy of the voltage reference, decouple the v ref and the c ref pin to ground with 0.1 f capacitors as shown in figure 27. buffer buffer 0.1 f 0.1 f v ref c ref 2.5v band gap reference to adc reference input aduc814 02748-a-034 figure 27. decoupling v ref and c ref if the internal voltage reference is to be used as a reference for external circuitry, the c ref output should be used. however, a buffer must be used in this case to ensure that no current is drawn from the c ref pin itself. the voltage on the c ref pin is that of an internal node within the buffer block, and its voltage is critical to adc and dac accuracy. as outlined in the reference input/output section of the specifications table, the internal band gap reference takes typically 80 msecs to power on and settle to its final value. to ensure accurate adc operation, one should wait for the adc to settle after power-on. if an external voltage reference is preferred, it should be con- nected to the v ref and c ref pins as shown in figure 28. bit 6 of the adccon1 sfr must be set to 1 to switch in the external reference voltage. to ensure accurate adc operation, the voltage applied to v ref must be between 1.0 v and av dd . in situations where analog input signals are proportional to the power supply (such as some strain gage applications) it can be desirable to connect the v ref pin directly to av dd . buffer c ref 1 = external 0 = internal aduc814 adccon1.6 v dd 02748-a-035 2.5v band gap reference external voltage reference to adc reference input 0.1 f 0.1 f v ref figure 28. using an external voltage reference operation of the adc with a reference voltage below 1.0 v, however, may incur loss of accuracy eventually resulting in missing codes or non-monotonicity. for that reason, do not use a reference voltage less than 1.0 v. configuring the adc in configuring the adc a number of parameters need to be set up. these parameters can be configured using the three sfrs: adccon1, adccon2, and adccon3, which are detailed in the following sections. the adcclk determines the speed at which the adc logic runs while performing an adc conversion. all adc timing parameters are calculated from the adcclk frequency. on the aduc814, the adcclk is derived from the maximum core frequency (f core ), 16.777216 mhz. the adcclk frequency is selected via adccon1 bits 5 and 4, which provide four core clock divide ratios of 8, 4, 16, and 32, generating adcclk values of 2 mhz, 4 mhz, 1 mhz, and 500 khz, respectively. the acquisition time (t acq ) is the number of adcclks that the adc input circuitry uses to sample the input signal. in most cases, an acquisition time of one adcclk provides more than adequate time for the aduc814 to acquire its signal before switching the internal track-and-hold amplifier into hold mode. the only exception is a high source impedance analog input, but this should be buffered first anyway because high source impedances can cause significant dc errors (see table 6). adccon1 bits 3 and 2 are used to select acquisition times of 1, 2, 3, and 4 adcclks.
aduc814 rev. a | page 27 of 72 both the adcclk frequency and the acquisition time are used in determining the adc conversion time. two other parameters are also used in this calculation. to convert the acquired signal into its corresponding digital output word takes 15 adcclk periods (t conv ). when a conversion is initiated, the start of conversion signal is synchronized to the adcclk. this synchro- nization (t sync ) can take from 0.5 to 1.5 adcclks to occur. the total adc conversion time t adc is calculated using the following formula: t adc = t sync + t acq + t conv assuming t sync = 1, t acq = 1 and f core /adcclk divider of 4. the total conversion time is calculated by t adc = (1 + 1 + 15) (1 / 4194304) t adc = 4.05 s these settings allow a maximum conversion speed or sampling rate of 246.7 khz. when converting on the temperature monitor channel, the conversion time is not controlled via the adccon registers. it is controlled in hardware and sets the adcclk to f core /32 and uses four acquisition clocks, giving a total adc conversion time of t adc = (1 + 4 + 15) (1 / 524288) = 38.14 s increasing the conversion time on the temperature monitor channel improves the accuracy of the reading. to further improve the accuracy, an external reference with low tempera- ture drift should also be used. initiating adc conversions after the adc has been turned on and configured, there are four methods of initiating adc conversions. single conversions can be initiated in software by setting the sconv bit in the adccon2 register via user code. this causes the adc to perform a single conversion and puts the result into the adcdatah/l sfrs. the sconv bit is cleared as soon as the adcdata sfrs have been updated. continuous conversion mode can be initiated by setting the cconv bit in adccon2 via user code. this performs back- to-back conversions at the configured rate (246.7 khz for the settings detailed previously). in continuous mode, the adc results must be read from the adcdata sfrs before the next conversion is completed to avoid loss of data. continuous mode can be stopped by clearing the cconv bit. an external signal can also be used to initiate adc conversions. setting bit 0 in adccon1 enables the logic to allow an external start-of-conversion signal on pin 7 ( convst ). this active low pulse should be at least 100 ns wide. the rising edge of this signal initiates the conversion. timer 2 can also be used to initiate conversions. setting bit 1 of adccon1 enables the timer 2 overflow signal to start a conversion. for timer 2 configuration information, see the timers/counters section. for both external convst and timer 2 overflow, the conver- sion rate must be equal to or greater than the conversion time (t adc ) to avoid incorrect adc results. when initiating conversions, the user must ensure that only one of the trigger modes is active at any one time. initiating conver- sions with more than one of the trigger modes active results in erratic adc behavior. adc high speed data capture mode the on-chip adc has been designed to run at a maximum conversion speed of 4.05 s (247 khz sampling rate). when converting at this rate, the aduc814 mcu has 4.05 s to read the adc result and store it in memory for further post processing; otherwise the next adc sample could be lost. the time to complete a conversion and store the adc results without errors is known as the throughput rate. in an interrupt driven routine, the mcu also has to jump to the adc interrupt service routine, which decreases the throughput rate of the aduc814. in applications where the aduc814 standard operating mode throughput is not fast enough, an adc high speed data capture (hsdc) mode is provided. in hsdc mode, adc results are transferred to the spi logic without intervention from the aduc814 core logic. in applica- tions where the adc throughput is slow, the hsdc logic operates in non-pipelined mode (figure 29). in this mode, there is adequate time for the adc conversion and the adc-to-spi data transfer to complete before the next start of conversion. as the adc throughput increases, the hsdc logic begins to operate in pipelined mode as shown in figure 30. adcdatah adcdatal mosi sclock busy convst 02748-a-036 figure 29. high speed data capture logic timing (non-pipelined mode)
aduc814 rev. a | page 28 of 72 adcdatah adcdatal adcdatah adcdatal adcdatah adcdatal mosi sclock busy convst 02748-a-037 figure 30. high speed data capture logic timing (pipelined mode) in this mode, the adc to spi data transfer occurs during the next adc conversion. to avoid loss of an adc result, the user must ensure that the adc to spi transfer rate is complete before the current adc conversion ends. to enable hsdc mode, bit 6 in adccon2 (adcspi) must be set and to enable the aduc814 to capture a contiguous sample stream at full adc update rates (247 khz). to configure the aduc814 in hsdc mode: 1. the adc must be put into one of its conversion modes. 2. the spi interface must be configured. (the spi configura- tion is detailed in the serial peripheral interface section). 3. enable hsdc by setting the adcspi bit in the adccon2 sfr. 4. apply trigger signal to the adc to perform conversions. once configured and enabled, the adc results are transferred from the adcdatah/l sfrs to the spidat register. figure 31 shows the hsdc logic configuration once the mode is enabled. the adc result is transmitted most significant bit first. in this case, the channel id is transmitted first, followed by the 12-bit adc result. when this mode is enabled, normal spi and port 3 operation is disabled; however, the core is free to continue code execution, including general housekeeping and communication tasks. this mode is disabled by clearing the adcspi bit. mux spidat 8 8 8 8 16 8 8 0 1 01 adc to spi control logic adcdatah adcdatal register adc edc spi logic data register end of conversion signal 02748-a-068 figure 31. high speed data capture logic adc offset and gain calibration overview the adc block incorporates calibration hardware and associated sfrs, which ensures optimum offset and gain performance from the adc at all times. as part of internal factory final test routines, the aduc814 is calibrated to its offset and gain specifications. the offset and gain coefficients obtained from this factory calibration are stored in non-volatile flash/ee memory. these are downloaded from the flash/ee memory to offset and gain calibration registers automatically on a power-up or a reset event. in many applications these factory-generated calibration coefficients suffice. however, the aduc814 adc offset and gain accuracy may vary from system to system due to board layout, grounding, clock speed, or system configuration, and so on. to get the best adc accuracy in your system, an adc calibration should be performed. two main advantages are derived from ensuring the adc calibration registers are initialized correctly. first, the internal errors in the adc can be reduced significantly to give superior dc performance; and second, system offset and gain errors can be removed. this allows the user to remove reference errors (whether an internal or external reference) and to use the full dynamic range of the adc by adjusting the analog input range of the part for a specific system. adc offset and gain calibration coefficients the aduc814 has two adc calibration coefficients, one for offset calibration and one for gain calibration. both the offset and gain calibration coefficients are 14-bit words, and each is stored in two registers located in the special function register (sfr) area. the offset calibration coefficient is divided into adcofsh (6 bits) and adcofsl (8 bits), and the gain cali- bration coefficient is divided into adcgainh (6 bits) and adcgainl (8 bits). the offset calibration coefficient compensates for dc offset errors in both the adc and the input signal. increasing the offset coefficient compensates for positive offset, and effectively pushes down the adc transfer function. decreasing the offset coefficient compensates for negative offset, and effectively pushes up the adc transfer function. the maximum offset that can be compensated is typically 3.5% of v ref , which equates to typi- cally 87.5 mv with a 2.5 v reference. similarly, the gain calibration coefficient compensates for dc gain errors in both the adc and the input signal. increasing the gain coefficient compensates for a smaller analog input signal range and scales up the adc transfer function, effectively increasing the slope of the transfer function. decreasing the
aduc814 rev. a | page 29 of 72 gain coefficient compensates for a larger analog input signal range and scales down the adc transfer function, effectively decreasing the slope of the transfer function. the maximum analog input signal range for which the gain coefficient can compensate is 1.035 v ref , and the minimum input range is 0.965 v ref , which equates to typically 3.5% of the reference voltage. calibrating the adc the aduc814 has two hardware calibration modes, device calibration and system calibration, that can be easily initiated by the user software. the adccon3 sfr is used to calibrate the adc. see table 8. device calibration is so called because the relevant signals used for the calibration are available internally to the adc. this calibration method can be used to compensate for significant changes in operating conditions, such as core frequency, analog input range, reference voltage and supply voltages. in this calibration mode, offset calibration uses internal agnd selected via the adccon2 register bits cs3Ccs0 (1011), and gain calibration uses internal v ref selected by cs3Ccs0 (1100). offset calibration should be executed first, followed by gain calibration. system calibration is so called because the agnd and v ref required for calibration must be the system agnd and v ref signals. these must be supplied in turn, externally, to the adc inputs. this calibration method can be used to compensate for both internal and external system errors. to perform system calibration using an external reference, tie system ground and reference to any two of the six selectable inputs. enable external reference mode (adccon1.6). select the channel connected to agnd via cs3Ccs0 and perform system offset calibration. select the channel connected to v ref via cs3Ccs0 and perform system gain calibration. initiating calibration in code when calibrating the adc, adccon1 should be set to the configuration in which the adc is used. the adccon3 register can then be used to configure and execute the offset and gain calibration required in sequence. configure the adc as required. in this case, adcclk = /4, acquisition time is set to 1 clock (t acq ), and adc is enabled. mov adccon1,#0d0h ;adc on, adcclk set to ;divide by 4, 1 acquisition ;clock (tacq) to perform device offset calibration: mov adccon2,#0bh ;select internal agnd mov adccon3,#25h ;select offset calibration, ;31 averages per bit, ;offset calibration to perform device gain calibration: mov adccon2,#0ch ;select internal v ref mov adccon3,#27h ;select offset calibration, ;31 averages per bit, ;offset calibration to perform system offset calibration: connect system agnd to an adc input (channel 0 in this case). mov adccon2,#00h ;select external agnd mov adccon3,#25h ;select offset calibration, ;31 averages per bit to perform system gain calibration: connect system v ref to an adc input (channel 1 in this case). mov adccon2,#01h ;select external v ref mov adccon3,#27h ;select offset calibration, ;31 averages / bit (numav), ;offset calibration the calibration cycle time t cal is calculated by t cal = 14 adcclk numav (16 + t acq ) for an adcclk/f core , divide ratio of 4, a t acq = 1 adcclk, numav = 31, the calibration cycle time is t cal = 14 (1 / 4194304) 31 (16 + 1) t cal = 1.76 ms in a calibration cycle, the adc busy flag (bit 7), instead of framing an individual adc conversion as in normal mode, goes high at the start of calibration and returns to zero only at the end of the calibration cycle. it can therefore be monitored in code to indicate when the calibration cycle is completed. the following code can be used to monitor the busy signal during a calibration cycle. wait: mov a, adccon3 ;move adccon3 to a jb acc.7, wait ;if bit 7 is set jump to wait ;else continue
aduc814 rev. a | page 30 of 72 nonvolitile flash/ee memory flash/ee memory overview the aduc814 incorporates flash/ee memory technology on- chip to provide the user with nonvolatile, in-circuit reprogram- mable code and data memory space. flash/ee memory takes the flexible in-circuit reprogrammable features of eeprom and combines them with the space efficient/ density features of eprom (see figure 32). because flash/ee technology is based on a single transistor cell architecture, a flash memory array such as eprom can be implemented to achieve the space efficiencies or memory densities required by a given design. like eeprom, flash memory can be programmed in-system at a byte level, although it must first be erased; the erase being performed in page blocks. thus, flash memory is often and more correctly referred to as flash/ee memory. eeprom technology eprom technology flash/ee memory technology in-circuit reprogrammable space efficient / density 02748-a-038 figure 32. flash/ee memory development incorporated in the aduc814, flash/ee memory technology allows the user to update program code space in-circuit without the need to replace one-time programmable (otp) devices at remote operating nodes. flash/ee memory and the aduc814 the aduc814 provides two arrays of flash/ee memory for user applications. there are 8 kbytes of flash/ee program space provided on-chip to facilitate code execution, therefore removing the requirement for an external discrete rom device. the pro- gram memory can be programmed using conventional third- party memory programmers. this array can also be programmed in-circuit, using the serial download mode provided. a 640-byte flash/ee data memory space is also provided on- chip. this may be used as a general-purpose nonvolatile scratchpad area. user access to this area is via a group of six sfrs. this space can be programmed at a byte level, although it must first be erased in 4-byte pages. aduc814 flash/ee memory reliability the flash/ee program and data memory arrays on the aduc814 are fully qualified for two key flash/ee memory characteristics: flash/ee memory cycling endurance and flash/ee memory data retention. endurance quantifies the ability of the flash/ee memory to be cycled through many program, read, and erase cycles. in real terms, a single endurance cycle is composed of four independent, sequential events: 1. initial page erase sequence 2. read/verify sequence 3. byte program sequence 4. second read/verify sequence in reliability qualification, every byte in both the program and data flash/ee memory is cycled from 00h to ffh until a first fail is recorded signifying the endurance limit of the on-chip flash/ee memory. as indicated in the specifications tables, the aduc814 flash/ee memory endurance qualification has been carried out in accor- dance with jedec specification a117 over the industrial temperature range of C40c to +125c. the results allow the specification of a minimum endurance figure over supply and a temperature of 100,000 cycles, with an endurance figure of 700,000 cycles being typical of operation at 25c. retention quantifies the ability of the flash/ee memory to retain its programmed data over time. again, the aduc814 has been qualified in accordance with the formal jedec retention lifetime specification (a117) at a specific junction temperature (t j = 55c). as part of this qualification procedure, the flash/ee memory is cycled to its specified endurance limit described above, before data retention is characterized. this means that the flash/ee memory is guaranteed to retain its data for its full specified retention lifetime every time the flash/ee memory is reprogrammed. it should be noted that retention lifetime, based on an activation energy of 0.6 ev, derates with t j as shown in figure 33. 40 60 70 90 t j junction temperature ( c) retention (years) 250 200 150 100 50 0 50 80 110 300 100 adi specification 100 years min. at t j = 55 c 02748-a-039 figure 33. flash/ee memory data retention
aduc814 rev. a | page 31 of 72 using flash/ee program memory the flash/ee program memory array can be programmed in one of two modes: serial downloading and parallel programming. serial downloading (in-circuit programming) as part of its factory boot code, the aduc814 facilitates code download via the standard uart serial port. serial download mode is automatically entered on power-up or during a hardware reset operation if the external dload pin is pulled high through an external resistor, as shown in figure 34. once in this mode, the user can download code to the program memory array while the device is sited in its target application hardware. a pc serial download executable is provided as part of the aduc814 quickstart development system. the serial download protocol is detailed in a microconverter applications note uc004 available from the adi microconverter website at www.analog.com/microconverter . dload aduc814 pull dload high via 1k ? resistor during reset to configure the aduc814 for serial download mode 1k ? dvdd 02748-a-040 figure 34. flash/ee memory serial download mode programming parallel programming the parallel programming mode is fully compatible with conventional third-party flash or eeprom device program- mers. a block diagram of the external pin configuration required to support parallel programming is shown in figure 35. the high voltage (12 v) supply required for flash/ee programming is generated using on-chip charge pumps to supply the high voltage program lines. v dd gnd p1.1 ? p1.4 dload reset p3 p1.0 aduc814 5v c ommand timing gnd p1.5 ? p1.7 v dd data enable 02748-a-041 figure 35. flash/ee memory parallel programming flash/ee program memory security the aduc814 facilitates three modes of flash/ee program memory security, which are described in the following sections. these modes can be independently activated, restricting access to the internal code space. these security modes can be enabled as part of the user interface available on all aduc814 serial or parallel programming tools referenced on the microconverter website at www.analog.com/microconverter. lock mode this mode locks code in memory, disabling parallel program- ming of the program memory, although reading the memory in parallel mode is still allowed. this mode is deactivated by initiating a code-erase command in serial download or parallel programming modes. secure mode this mode locks code in memory, disabling parallel program- ming (program and verify/read commands). this mode is deactivated by initiating a code-erase command in serial download or parallel programming modes. serial safe mode this mode disables serial download capability on the device. if serial safe mode is activated and an attempt is made to reset the part into serial download mode, i.e., reset asserted and de- asserted with dload high, the part interprets the serial download reset as a normal reset only. it therefore does not enter serial download mode but only executes a normal reset sequence. serial safe mode can be disabled only by initiating a code-erase command in parallel programming mode.
aduc814 rev. a | page 32 of 72 using flash/ee data memory the user flash/ee data memory array consists of 640 bytes that are configured into 160 (00h to 9fh) 4-byte pages as shown in figure 36. byte 1 9fh byte 2 byte 3 byte 4 byte 1 00h byte 2 byte 3 byte 4 02748-a-042 figure 36. flash/ee data memory configuration as with other aduc814 user-peripheral circuits, the interface to this memory space is via a group of registers mapped in the sfr space. eadrl is used to hold the 8-bit address of the page to be accessed. a group of four data registers (edata1C4) is used to hold 4-byte page data just accessed. finally, econ is an 8-bit control register that may be written with one of five flash/ee memory access commands to trigger various read, write, erase, and verify functions. these registers can be summarized as follows: econ sfr address b9h function controls access to 640 bytes flash/ee data space. default 00h eadrl sfr address c6h function holds the flash/ee data page address. (640 bytes = > 160 page addresses) default 00h edata1C4 sfr address bch to bfh, respectively function holds flash/ee data memory page write or page read data bytes. default edata1C4 > 00h a block diagram of the sfr interface to the flash/ee data memory array is shown in figure 37. byte 1 eadrl econ command interpreter logic function: receives command data function: interprets the flash command word function: holds the 4-byte page data function: holds the 8-bit page address pointer econ edata4 (byte 4) edata3 (byte 3) edata2 (byte 2) edata1 (byte 1) 9fh byte 2 byte 3 byte 4 byte 1 00h byte 2 byte 3 byte 4 02748-a-043 figure 37. flash/ee data memory control and configuration econflash/ee memory control sfr this sfr acts as a command interpreter and may be written with one of five command modes to enable various read, program, and erase cycles as detailed in table 11. table 11. econCflash/ee memory control register command modes command byte command mode description 01h read results in 4 bytes being read into edata1 C4 from memory page address contained in eadrl. 02h program results in 4 bytes (edata1C4) being written to me mory page address in eadrl. this write command assumes the designated write page has been erased. 03h reserved for internal use. 03h shou ld not be written to the econ sfr. 04h verify allows the user to verify if data in edata1C4 is contained in page address designated by eadrl. a subsequent read of the econ sfr results in a zero being read if the verification is valid, a nonzero value is read to indicate an invalid verification. 05h erase results in an erase of the 4-byte page designated in eadrl. 06h erase-all results in an erase of the full fl ash/ee aata memory, 160-page (640 bytes) array. 07h to ffh reserved for future use.
aduc814 rev. a | page 33 of 72 flash/ee memory timing the typical program/erase times for the flash/ee data memory are erase full array (640 bytes) 2 ms erase single page (4 bytes) 2 ms program page (4 bytes) 250 s read page (4 bytes) within single instruction cycle using the flash/ee memory interface as with all flash/ee memory architectures, the array can be programmed in-system at a byte level, although it must be erased first, the erasure being performed in page blocks (4-byte pages in this case). a typical access to the flash/ee data array involves setting up the page address to be accessed in the eadrl sfr, configuring the edata1C4 with data to be programmed to the array (the edata sfrs are not written to for read accesses), and finally, writing the econ command word, which initiates one of the modes shown table 11. note that a given mode of operation is initiated as soon as the command word is written to the econ sfr. the core micro- controller operation on the aduc814 is idled until the requested program/read or erase mode is completed. in practice, this means that even though the flash/ee memory mode of operation is typically initiated with a two-machine cycle mov instruction (to write to the econ sfr), the next instruction cannot be executed until the flash/ee operation is complete (250 s or 2 ms later). this means that the core does not respond to interrupt requests until the flash/ee operation is complete, though the core peripheral functions like counter/ timers continue to count and time as configured throughout this period. although the 640-byte user flash/ee array is shipped from the factory pre-erased, i.e., byte locations set to ffh, it is nonetheless good programming practice to include an erase-all routine as part of any configuration/setup code running on the aduc814. an erase-all command consists of writing 06h to the econ sfr, which initiates an erasure of all 640 byte locations in the flash/ee array. this command coded in 8051 assembly appears as mov econ, #06h ; erase all command ; 2 ms duration programming a byte in general terms, a byte in the flash/ee array can be programmed only if it has been erased previously. to be more specific, a byte can only be programmed if it already holds the value ffh. because of the flash/ee architecture, this erasure must happen at a page level; therefore, a minimum of four bytes (1 page) are erased when an erase command is initiated. a more specific example of the program-byte process is shown below. in this example the user writes f3h into the second byte on page 03h of the flash/ee data memory space while preserving the other three bytes already in this page. because the user is required to modify only one of the page bytes, the full page must be first read so that this page can then be erased without the existing data being lost. this example, coded in 8051 assembly, appears as mov eadrl,#03h ; set page address ; pointer mov econ,#01h ; read page mov edata2,#0f3h ; write new byte mov econ,#05h ; erase page mov econ,#02h ; write page ; program flash/ee)
aduc814 rev. a | page 34 of 72 user interface to other on-chip aduc814 peripherals this section gives a brief overview of the various peripherals also available on-chip. a summary of the sfrs used to control and configure these peripherals is also given. dacs the aduc814 incorporates two 12-bit, voltage output dacs on-chip. each dac has a rail-to-rail voltage output buffer capa- ble of driving 10 k?/100 pf. they have two selectable ranges, 0 v to v ref (an external or the internal band gap 2.5 v reference) and 0 v to av dd , and can operate in 12-bit or 8-bit modes. dac operation is controlled by a single special function (sfr) register, daccon. each dac has two data registers, dacxh/l. the dac0 and dac1 outputs share pins with adc inputs adc4 and adc5, respectively. when both dacs are on, the number of analog inputs is reduced to four. note that in 12-bit mode, the dac voltage output is updated as soon as the dacl data sfr has been written; therefore, the dac data registers should be updated as dach first, followed by dacl. when using the dacs on the v ref range it is necessary to power up the adc to enable the reference to the dac section. see note 1. daccon dac control register sfr address fdh power-on default 04h bit addressable no mode rng1 rng0 clr1 clr0 sync pd1 pd0 table 12. daccon sfr bit designations bit no. name description 7 mode mode select bit. selects eith er 12-bit or 8-bit mode for both dacs. set to 1 by the user to enable 8-bit mode (dacxl is the active data register). set to 0 by the user to enable 12-bit mode. 6 rng1 dac1 output voltage range select bit. set to 1 by the user to configure dac1 range of 0 v to av dd . set to 0 by the user to configure dac1 range of 0 v to 2.5 v (v ref range) 1 . 5 rng0 dac0 output voltage range select bit. set to 1 by he user to configure dac0 range of 0 v to av dd . set to 0 by the user to configure dac0 range of 0 v to 2.5 v (v ref range) 1 . 4 clr1 dac1 clear bit. set to 1 by the user to enable normal dac1 operation. set to 0 by the user to forc e dac1 output voltage to 0 v. 3 clr0 dac0 clear bit. set to 1 by the user to enable normal dac0 operation. set to 0 by the user to forc e dac0 output voltage to 0 v. 2 sync dac0/1 update synchronization bit. set to 1 by the user to enable asynch ronous update mode. the da c outputs update as soon as the dacxl sfrs are written. set to 0 by the user to enable synchronous update mode . the user can simultaneously update both dacs by first updating the dacxh/l sfrs while sync is 0. both dacs then update simultaneo usly when the sync bit is set to 1. 1 pd1 dac1 power-down bit. set to 1 by the user to power up dac1. set to 0 by the user to power down dac1. 0 pd0 dac0 power-down bit. set to 1 by the user to power up dac0. set to 0 by the user to power down dac0. 1 for correct dac operation on the 2.5 v to v ref range, the adc must be powered on.
aduc814 rev. a | page 35 of 72 dacxh/l dac0 and dac1 data registers function dac data registers, written by the user to update the dac outputs. sfr address dac0l (dac0 data low byte) C> f9h dac0h (dac0 data high byte) C> fah; dac1l (dac1 data low byte) C> fbh dac1h (dac1 data high byte) C> fch power-on default 00h C> both dac0 and dac1 data registers. bit addressable no C> both dac0 and dac1 data registers. the 12-bit dac data should be written into dacxh/l right-justified such that dacl contains the lower eight bits, and the lower nibble of dach contains the upper four bits. using the dacs the on-chip dac architecture consists of a resistor string dac followed by an output buffer amplifier, the functional equivalent of which is illustrated in figure 38. features of this architecture include inherent guaranteed monotonicity and excellent differ- ential linearity. output buffer high z disable (from mcu) dac0 r r r r r aduc814 av dd v ref 02748-a-044 figure 38. resistor string dac functional equivalent as illustrated in figure 38, the reference source for each dac is user selectable in software. it can be either av dd or v ref . in 0 v-to-av dd mode, the dac output transfer function spans from 0 v to the voltage at the av dd pin. in 0 v-to-v ref mode, the dac output transfer function spans from 0 v to the internal v ref , or if an external reference is applied, the voltage at the v ref pin. the dac output buffer features a true rail-to-rail output stage implementation. this means that, unloaded, each output is capable of swinging to within less than 100 mv of both av dd and ground. moreover, the dacs linearity specification (when driving a 10 k? resistive load to ground) is guaranteed through the full transfer function except codes 0 to 48, and, in 0 v-to- av dd mode only, codes 3945 to 4095. linearity degradation near ground and v dd is caused by saturation of the output buffer, and a general representation of its effects (neglecting offset and gain error) is illustrated in figure 39. the dotted line in figure 39 indicates the ideal transfer function, and the solid line represents what the transfer function might look like with endpoint nonlinearities due to saturation of the output buffer. note that figure 39 represents a transfer function in 0 v-to-v dd mode only. in 0 v-to-v ref mode (with v ref < v dd ), the lower nonlinearity would be similar, but the upper portion of the transfer function would follow the ideal line right to the end (v ref in this case, not v dd ), showing no signs of upper endpoint linearity error. v dd v dd ?50mv 50mv 0mv v dd ?100mv 100mv 000h fffh 02748-a-045 figure 39. endpoint nonlinearities due to amplifier saturation the endpoint nonlinearities conceptually illustrated in figure 39 get worse as a function of output loading. most aduc814 specifications assume a 10 k? resistive load to ground at the dac output. as the output is forced to source or sink more current, the nonlinear regions at the top or bottom (respectively) of figure 39 become larger. with larger current demands, this can significantly limit output voltage swing. figure 40 and figure 41 illustrate this behavior. note that the upper trace in each of these figures is valid only for an output range selection of 0 v-to-av dd . in 0 v-to-v ref mode, dac loading does not cause high-side voltage drops as long as the reference voltage remains below the upper trace in the corresponding figure. for example, if av dd = 3 v and v ref = 2.5 v, the high-side voltage is not affected by loads less than 5 ma. but around 7 ma, the upper curve in figure 41 drops below 2.5 v (v ref ), indicating that at these higher currents the output cannot reach v ref .
aduc814 rev. a | page 36 of 72 source/sink current (ma) 5 0 5 10 15 output voltage (v) 4 3 2 1 0 dac loaded with 0000h dac loaded with 0fffh 02748-a-046 figure 40. source and sink current capability with v ref = v dd = 5 v source/sink current (ma) 4 0 5 10 15 output voltage (v) 3 1 0 dac loaded with 0000h dac loaded with 0fffh 02748-a-046 figure 41. source and sink current capability with v ref = v dd = 3 v for larger loads, the current drive capability may not be sufficient. to increase the source and sink current capability of the dacs, an external buffer should be added, as shown in figure 42. aduc814 dac0 dac1 02748-a-048 figure 42. buffering the dac outputs the dac output buffer also features a high impedance disable function. in the chips default power-on state, both dacs are disabled, and their outputs are in a high impedance state (or three-state) where they remain inactive until enabled in software. this means that if a zero output is desired during power-up or power-down transient conditions, then a pull- down resistor must be added to each dac output. assuming this resistor is in place, the dac outputs remain at ground potential whenever the dac is disabled.
aduc814 rev. a | page 37 of 72 on-chip pll the aduc814 is intended for use with a 32.768 khz watch crystal. an on-board pll locks onto a multiple (512) of this 32.768khz frequency to provide a stable 16.777216 mhz clock for the system. the core can operate at this frequency or at binary submultiples of it to allow power saving in cases where maximum core performance is not required. the default core clock is the pll clock divided by 8 (2 cd = 2 3 ) or 2.097152 mhz. the pll is controlled via the pllcon special function register. pllcon pll control register sfr address d7h power-on default 03h bit addressable no osc_pd lock --- --- fint cd2 cd1 cd0 table 13. pllcon sfr bit designations bit no. name description 7 osc_pd oscillator power-down bit. set by the user to halt the 32 khz oscillator in power-down mode. cleared by the user to enable the 32 khz oscillator in power-down mode. this feature allows the oscillator to continue clocking the tic even in power-down mode. 6 lock pll lock bit. th is is a read-only bit. set automatically at power-on to indicate that the pll loop is correctly tracking the crystal clock. if the external crystal becomes subsequently disconnect ed, the pll rails and the core halts. cleared automatically at power-o n to indicate that the pll is not correctly tracking the crys tal clock. this may be due to the absence of a crystal clock or an external crystal at power- on. in this mode, the pll o utput is 16.78 mhz 20%. 5 --- reserved. should be written with 0. 4 --- reserved. should be written with 0. 3 fint fast interrupt response bit. set by the user to enable the response to any interrupt to be executed at the fastest core clock frequency, regardless of the configuration of the cd2Ccd0 bits (see below). on ce user code has returned fr om an interrupt, the core resumes code execution at the core cl ock selected by the cd2Ccd0 bits. cleared by the user to disable the fast interrupt response feature. 2 cd2 cpu (core clock) divider bits. 1 cd1 this number determines the frequency at which the microcontroller core operates. 0 cd0 cd2 cd1 cd0 core clock frequency (mhz) 0 0 0 16.777216 0 0 1 8.388608 0 1 0 4.194304 0 1 1 2.097152 (default core clock frequency) 1 0 0 1.048576 1 0 1 0.524288 1 1 0 0.262144 1 1 1 0.131072
aduc814 rev. a | page 38 of 72 time interval counter (tic) a time interval counter is provided on-chip for counting longer intervals than the standard 8051 compatible timers are capable of. the tic is capable of time-out intervals ranging from 1/128th second to 255 hours. furthermore, this counter is clocked by the crystal oscillator rather than by the pll and thus has the ability to remain active in power-down mode and to time long power- down intervals. this has obvious applications for remote battery- powered sensors where regular, widely spaced readings are required. six sfrs are associated with the time interval counter, timecon being its control register. depending on the configuration of the it0 and it1 bits in timecon, the selected time counter register overflow clocks the interval counter. when this counter is equal to the time interval value loaded in the intval sfr, the tii bit (timecon.2) is set and generates an interrupt if enabled. (see ieip2 sfr description under the interrupt system section.) if the aduc814 is in power-down mode, again with tic interrupt enabled, the tii bit wakes up the device and resumes code execu- tion by vectoring directly to the tic interrupt service vector address at 0053h. the tic-related sfrs are described in table 14. note that the time based sfrs can be written initially with the current time; the tic can then be controlled and accessed by the user software. in effect, this facilitates the implementation of a real-time clock. a block diagram of the tic is shown in figure 43. 8-bit prescaler hundredths counter hthsec second counter sec minute counter min hour counter hour tien interval timeout time interval counter interrupt 8-bit interval counter timer intval intval interval timebase selection mux tcen 32.768khz external crystal its0, 1 compare count = intval 02748-a-049 figure 43. time interval coun ter, simplified block diagram
aduc814 rev. a | page 39 of 72 timecon tic control register sfr address a1h power-on default 00h bit addressable no --- tfh its1 its0 sti tii tien tcen table 14. timecon sfr bit designations bit no. name description 7 --- reserved. 6 tfh twenty-four hour select bit. set by the user to enable the hour counter to count from 0 to 23. cleared by the user to enable the ho ur counter to count from 0 to 255. the time interval counter continues to count after a reset when in hours/min/ sec mode. if the part is in 24 hour mode though, this bit is reset and th e part now counts in 255 hour mode. th e following code segment can be used to set the tic back into 24 ho ur mode after a reset event. mov a,timecon ;move contents of timecon into acc rrc a ;rotate acc right by 1 place into carry jnc notset ;if carry bit is ! = 1 jump to notset, else continue with next line orl timecon,#01000000b ; if carry bit = 1 for last line, then logical or timecon with 40h notse: ;continuation of normal code from here its1 interval timebase selection bits. 4 its0 written by the user to determin e the interval counter update rate. its1 its0 interval timebase 0 0 1/128 second 0 1 seconds 1 0 minutes 1 1 hours 3 sti single time interval bit. set by the user to generate a single interval t imeout. if set, a timeout clears the tien bit. cleared by the user to allow the interval counter to be automatically reloaded and st art counting again at each interval timeout. 2 tii tic interrupt bit. set when the 8-bit interval counter matches the value in the intval sfr. cleared by the user software. 1 tien time interval enable bit. set by the user to enable th e 8-bit time interval counter. cleared by the user to disable and clea r the contents of the interval counter. 0 tcen time clock enable bit. set by the user to enable the time clock to the time interval counters. cleared by the user to disable the clock to the time interval counters and clear the time interval sfrs. the time registers (hthsec, sec, min and hour) can be written while tcen is low.
aduc814 rev. a | page 40 of 72 intval user time interval select register function user code writes the required time interval to this register. when the 8-bit interval counter is equal to the time interval value loaded in the intval sfr, the tii bit (timecon.2) is set and generates an interrupt if enabled. (see the ieip2 sfr description in the interrupt system section.) sfr address a6h power-on default 00h bit addressable no valid value 0 to 255 decimal hthsec hundredths seconds time register function this register is incremented in 1/128 second in tervals once tcen in timecon is active. the hthsec sfr counts from 0 to 127 before rolling over to increment the sec time register. sfr address a2h power-on default 00h bit addressable no valid value 0 to 127 decimal sec seconds time register function this register is incremented in 1-second intervals once tcen in timecon is active. the sec sfr counts from 0 to 59 before rolling over to increment the min time register. sfr address a3h power-on default 00h bit addressable no valid value 0 to 59 decimal min minutes time register function this register is incremented in 1-minute intervals once tcen in timecon is active. the min sfr counts from 0 to 59 before rolling over to increment the hour time register. sfr address a4h power-on default 00h bit addressable no valid value 0 to 59 decimal hour hours time register function this register is incremented in 1-hour intervals once tcen in timecon is active. if the tfh bit (timecon.6) is set to 1 the hour sfr counts from 0 to 23 before rolling over to 0. if the tfh bit is set to 0, the hour sfr counts from 0 to 255 before rolling over to 0. sfr address a5h power-on default 00h bit addressable no valid value 0 to 23 decimal
aduc814 rev. a | page 41 of 72 watchdog timer the purpose of the watchdog timer is to generate a device reset or interrupt within a reasonable amount of time if the aduc814 enters an erroneous state, possibly due to a programming error, electrical noise, or rfi. the watchdog function can be disabled by clearing the wde (watchdog enable) bit in the watchdog control (wdcon) sfr. when enabled, the watchdog circuit generates a system reset or interrupt (wds) if the user program fails to set the watchdog (wde) bit within a predetermined amount of time (see pre3C0 bits in wdcon). the watchdog timer itself is a 16-bit counter that is clocked at 32.768 khz. the watchdog timeout interval can be adjusted via the pre3C0 bits in wdcon. full control and status of the watchdog timer function can be controlled via the watchdog timer control sfr (wdcon). the wdcon sfr can be written only by the user software if the double write sequence (wdwr) described in table 15 is initiated on every write access to the wdcon sfr. wdcon watchdog timer control register sfr address c0h power-on default 10h bit addressable yes pre3 pre2 pre1 pre0 wdir wds wde wdwr table 15. wdcon sfr bit designation bit no. name description 7 pre3 6 pre2 5 pre1 watchdog timer prescale bits. the watchdog timeout period is given by the equation t wd = (2 pre (2 9 /f pll )) where f pll = 32.768 khz and pre is defined as follows: pre3 pre2 pre1 pre0 timeout period (ms) action 0 0 0 0 15.6 reset or interrupt 0 0 0 1 31.2 reset or interrupt 0 0 1 0 62.5 reset or interrupt 0 0 1 1 125 reset or interrupt 0 1 0 0 250 reset or interrupt 0 1 0 1 500 reset or interrupt 0 1 1 0 1000 reset or interrupt 0 1 1 1 2000 reset or interrupt 1 0 0 0 0.0 immediate reset 4 pre0 pre3C0 > 1001 reserved 3 wdir watchdog interrupt request. if this bit is set by the user, the watchdog generates an interrupt response instead of a system reset when the watchdog timeout period has expired. this interrupt is not disabled by the clr ea instruct ion and it is also a fixed, high-priority interrupt. if the watchdog is not being used to mo nitor the system, it can alternatively be used as a timer. the prescaler is used to set the timeout period in which an in terrupt is generated. (see table 33, note 1, in the interrupt system section.) 2 wds watchdog status bit. set by the watchdog controller to indica te that a watchdog timeout has occurred. cleared by writing a 0 or by an external hardware reset. it is not cleared by a watchdog reset. 1 wde watchdog enable bit. set by the user to enable the watchdog and clear its counters. if this bit is no t set by the user within the watchdog timeout period, the watchdog generates a reset or interrupt, depending on wdir. cleared under the following conditions: user writes 0, watchdog reset (wdir = 0); hardware reset; psm interrupt. 0 wdwr watchdog write enable bit. to write data into the wdcon sfr invo lves a double instruction sequence. the wdwr bit must be set and followed immediately by a write instruction to the wdcon sfr. for example: clr ea ; disable interrupts while writing to wdt setb wdwr ; allow write to wdcon mov wdcon, #72h ; enable wdt for 2.0s timeout set b ea ; enable interrupts again (if rqd)
aduc814 rev. a | page 42 of 72 power supply monitor as its name suggests, the power supply monitor, once enabled, monitors the supply (dv dd ) on the aduc814. it indicates when any of the supply pins drop below one of four user-selectable voltage trip points from 2.63 v to 4.63 v. for correct operation of the power supply monitor function, dv dd must be equal to or greater than 2.7 v. monitor function is controlled via the psmcon sfr. if enabled via the ieip2 sfr, the monitor interrupts the core using the psmi bit in the psmcon sfr. this bit is not cleared until the failing power supply has returned above the trip point for at least 250 ms. this monitor function allows the user to save working registers to avoid possible data loss due to the low supply condition, and also ensures that normal code execution does not resume until a safe supply level is well established. the supply monitor is also protected against spurious glitches triggering the interrupt circuit. psmcon power supply monitor control register sfr address dfh power-on default deh bit addressable no ---- cmpd psmi tpd1 tpd0 ---- ---- psmen table 16. psmcon sfr bit designations bit no. name description 7 psmcon.7 reserved. 6 cmpd dv dd comparator bit. this is a read-only bit and dire ctly reflects the state of the dv dd comparator. read 1 indicates that the dv dd supply is above its selected trip point. read 0 indicates that the dv dd supply is below its selected trip point. 5 psmi power supply monitor interrupt bit. this bit is set high by the microconverter if cmpd is low, indicating low digital supply. the psmi bit can be used to interrupt the processor. once cmpd returns and remains high, a 250 ms counter is st arted. when this counter times out, the psmi interrupt is cleared. psmi can also be written by the user; however, if the comparator output is low, it is not possible fo r the user to clear psmi. 4 tpd1 dv dd trip point selection bits. these bits select the dv dd trip-point voltage as follows: tpd1 tpd0 selected dv dd trip point (v) 0 0 4.63 0 1 3.08 1 0 2.93 3 tpd0 1 1 2.63 2 psmcon.2 reserved. 1 psmcon.1 reserved. 0 psmen power supply monitor enable bit. set to 1 by the user to enable th e power supply monitor circuit. cleared to 0 by the user to disabl e the power supply monitor circuit.
aduc814 rev. a | page 43 of 72 aduc814 configuration register (cfg814) the aduc814 is housed in a 28-lead tssop package. to maintain as much functional compatibility with other microconverter products, some pins share multiple i/o functionality. switching between these functions is controlled via the aduc814 configuration sfr, cfg814, located at sfr address 9ch. a summary of these functions is described and a detailed bit designation for the cfg814 sfr is given in table 17. serial peripheral interface the spi interface on the aduc814 shares the same pins as digital outputs p3.5, p3.6, and p3.7. the spe bit in spicon is used to select which interface is active at any one time. this is described in greater detail in the next section. by default, these pins operate as standard port 3 pins. bit 0 of the cfg814 sfr must be set to 1 to enable the spi interface on these port 3 pins. external clock the aduc814 is intended for use with a 32.768 khz watch crystal. the on-chip pll locks onto a multiple of this to provide a stable 16.777216 mhz clock for the device. on the aduc814, p3.5 alternate functions include t1 input and slave select in spi master mode. p3.5 also functions as external clock input, extclk, selected via bit 1 of the cfg814 sfr. when selected, this external clock bypasses the pll and is used as the clock for the device, therefore allowing the aduc814 to be synchronized to the rest of the application system. the maximum input frequency of this external clock is 16.777216 mhz. if selected, the extclk signal affects the timing of the majority of peripherals on the aduc814 including the adc, eeprom controller, watchdog timer, spi interface clock, and the microconverter core clock. cfg814 aduc814 configuration register sfr address 9ch power-on default 04h bit addressable no extclk ser_en table 17. cfg814 sfr bit designations bit no. name description 1 extclk external clock selection bit. set to 1 to enable extclk as mcu core clock. cleared to 0 to enable xtal an d pll as the mcu core clock. 0 ser_en serial interface enable bit. set to 1 by the user to enable the spi inte rface onto the p3.5, p3.6, and p3.7 pins. cleared to 0 by the user to enable standard port 3 functionality on the p3.5, p3.6, and p3.7 pins.
aduc814 rev. a | page 44 of 72 serial peripheral interface the aduc814 integrates a complete hardware serial peripheral interface (spi) on-chip. spi is an industry-standard synchronous serial interface that allows eight bits of data to be synchronously transmitted and received simultaneously, i.e., full duplex. note that the spi pins miso and mosi are multiplexed with digital outputs p3.6 and p3.7. these pins are controlled via the cfg814.0 bit in the cfg814 sfr (table 17), which configures the relevant port 3 pins for normal operation or serial port operation. when the relevant port 3 pins are configured for serial interface operation via the cfg814 sfr, the spe bit in the spicon sfr configures spi or i 2 c operation (see spe bit description in table 18). spi can be configured for master or slave operation, and typically consists of four pins described next. miso (master in, slave out data i/o pin) the miso pin (pin 23) is configured as an input line in master mode and as an output line in slave mode. the miso line on the master (data in) should be connected to the miso line in the slave device (data out). the data is transferred as byte-wide (8-bit) serial data, msb first. mosi (master out, slave in pin) the mosi pin (pin 24) is configured as an output line in master mode and as an input line in slave mode. the mosi line on the master (data out) should be connected to the mosi line in the slave device (data in). the data is transferred as byte-wide (8-bit) serial data, msb first. sclock (serial clock i/o pin) the sclock pin (pin 25) is used to synchronize the data being transmitted and received through the mosi and miso data lines. a single data bit is transmitted and received in each sclock period. therefore, a byte is transmitted/received after eight sclock periods. the sclock pin is configured as an output in master mode and as an input in slave mode. in master mode, the bit rate, polarity, and phase of the clock are controlled by the cpol, cpha, spr0, and spr1 bits in the spicon sfr (see table 18). in slave mode, the spicon register must be configured with the phase and polarity (cpha and cpol) of the expected input clock. in both master and slave modes, the data is transmitted on one edge of the sclock signal and sampled on the other. it is important, therefore, that the cpha and cpol are configured the same for the master and slave devices. ss (slave select input pin) the ss input pin (pin 22) is used only when the aduc814 is configured in slave mode to enable the spi peripheral. this line is active low. data is received or transmitted in slave mode only when the ss pin is low, allowing the aduc814 to be used in single master, multislave spi configurations. if cpha = 1, then the ss input may be permanently pulled low. with cpha = 0, the ss input must be driven low before the first bit in a byte- wide transmission or reception and return high again after the last bit in that byte-wide transmission or reception. in spi slave mode, the logic level on the external ss pin can be read via the spr0 bit in the spicon sfr. the following sfr registers are used to control the spi interface. spicon spi control register sfr address f8h power-on default 04h bit addressable yes ispi wcol spe spm cpol cpha spr1 spr0 table 18. spicon sfr bit designations bit no. name description 7 ispi spi interrupt bit. set by the microconverter at the end of each spi transfer. cleared directly by the user code or indirectly by reading the spidat sfr. 6 wcol write collision error bit. set by the microconverter if spidat is written to while an spi transfer is in progress. cleared by the user. 5 spe spi interface enable bit. set by the user to enable the spi interface. cleared by the user to enable the i 2 c interface. 4 spim spi master/slave mode select bit. set by the user to enable master mo de operation (sclock is an output). cleared by the user to enable slave mode operation (sclock is an input). 3 cpol 1 clock polarity select bit. set by the user if sclock idles high. cl eared by the user if sclock idles low.
aduc814 rev. a | page 45 of 72 bit no. name description 2 cpha 1 clock phase select bit. set by the user if the leading sclo ck edge is to transmit data. cleared by the user if the trailing sclock edge is to transmit data. 1 spr1 spi bit rate select bits. 0 spr0 these bits select the sclock rate (bit rate) in master mode as follows: spr1 spr0 selected bit rate 0 0 f core /2 0 1 f core /4 1 0 f core /8 1 1 fcore/16 in spi slave mode,where spim = 0, the logic level on the external ss pin (pin 22), can be read via the spr0 bit. 1 the cpol and cpha bits should both contain the same values for master and slave devices. spidat spi data register function the spidat sfr is written by the user to transmit data over the spi interface or read by the user code to read data just received by the spi interface. sfr address f7h power-on default 00h bit addressable no using the spi interface depending on the configuration of the bits in the spicon sfr shown in table 18, the aduc814 spi interface transmits or receives data in a number of possible modes. figure 44 shows all possible aduc814 spi configurations and the timing relation- ships and synchronization between the signals involved. sclock (cp0l = 0) sclock (cp0l = 1) (cpha = 1) (cpha = 0) sample input ispi flag data output ispi flag sample input data output ? ? msb bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 lsb msb bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 lsb ss 02748-a-050 figure 44. aduc814, spi timing, all modes spi interfacemaster mode in master mode, the sclock pin is always an output and generates a burst of eight clocks whenever user code writes to the spidat register. the sclock bit rate is determined by spr0 and spr1 in spicon. it should also be noted that the ss pin is not used in master mode. if the aduc814 needs to assert the ss pin on an external slave device, a port digital output pin should be used. in master mode, a byte transmission or reception is initiated by a write to spidat. eight clock periods are gener- ated via the sclock pin and the spidat byte being transmitted via mosi. with each sclock period, a data bit is also sampled via miso. after eight clocks, the byte is completely transmitted, and the input byte is waiting in the input shift register. the ispi flag is set automatically and an interrupt occurs if enabled. the value in the shift register is latched into spidat. spi interfaceslave mode in slave mode, the sclock is an input. the ss pin must also be driven low externally during the byte communication. trans- mission is also initiated by a write to spidat. in slave mode, a data bit is transmitted via miso, and a data bit is received via mosi on each input sclock. after eight clocks, the byte is completely transmitted and the input byte is waiting in the input shift register. the ispi flag is set automatically and an interrupt occurs if enabled. the value in the shift register is latched into spidat only when the transmission/reception of a byte is complete. the end of transmission occurs after the eighth clock is received, if cpha = 1, or when ss returns high if cpha = 0.
aduc814 rev. a | page 46 of 72 i 2 c compatible interface the aduc814 supports a 2-wire serial interface mode that is i 2 c compatible. the i 2 c compatible interface shares its pins with the on-chip spi interface, and therefore the user can enable only one interface or the other at any given time (see the spe bit in spicon sfr, table 18). application note uc001 describes the operation of this interface as implemented, and is available on the microconverter website at www.analog.com/microconverter . this interface can be configured as a software master or hard- ware slave, and uses two pins in the interface. sdata (pin 24) serial data i/o sclock (pin 25) serial clock three sfrs are used to control the i 2 c compatible interface. i2ccon i 2 c control register sfr address e8h power-on default 00h bit addressable yes mdo mde mco mdi i2cm i2crs i2ctx i2ci table 19. i2ccon sfr bit designations bit no. name description 7 mdo i 2 c software master data outp ut bit (master mode only). this data bit is used to implement a master i 2 c transmitter interface in software. da ta written to this bit is output on the sdata pin if the data outp ut enable (mde) bit is set. 6 mde i 2 c software master data output en able bit (master mode only). set by the user to enable th e sdata pin as an output (tx). cleared by the user to enable sdata pin as an input (rx). 5 mco i 2 c software master clock outp ut bit (master mode only). this data bit is used to implement a master i 2 c transmitter interface in software. da ta written to this bit is output on the sclock pin. 4 mdi i 2 c software master data inp ut bit (master mode only). this data bit is used to implement a master i 2 c receiver interface in software. data on the sdata pin is latched into this bit on sclock if the data output enable (mde) bit is 0. 3 i2cm i 2 c master/slave mode bit. set by the user to enable i 2 c software master mode. cleared by the user to enable i 2 c hardware slave mode. 2 i2crs i 2 c reset bit (slave mode only). set by the user to reset the i 2 c interface. cleared by the user code for normal i 2 c operation. 1 i2ctx i 2 c direction transfer bit (slave mode only). set by the microconverter if the interface is transmitting. cleared by the microconverter if the interface is receiving. 0 i2ci i 2 c interrupt bit (slave mode only). set by the microconverter after a byte has been transmitted or received. cleared automatically when user code reads the i2cdat sfr (see th e i2cdat sfr description that follows). i2cadd i 2 c address register function holds the i 2 c peripheral address for the part. it may be overwritten by the user code. application note uc001 at www.analog.com/microconverter describes the format of the 7-bit address in detail. sfr address 9bh power-on default 55h bit addressable no i2cdat i 2 c data register function the i2cdat sfr is written to by the user code to transmit data over the i 2 c interface, or it is read by the user code to read data just received via the i 2 c interface. accessing the i2cdat register automatically clears any pending i 2 c interrupts and the i2ci bit in the i2ccon sfr. sfr address 9ah power-on default 00h bit addressable no
aduc814 rev. a | page 47 of 72 8051 compatible on-chip peripherals this section gives a brief overview of the various secondary peripheral circuits that are available to the user on-chip. these functions are fully 8051 compatible and are controlled via standard 8051 sfr bit definitions. parallel i/o ports 1 and 3 the aduc814 has two input/output ports. in addition to per- forming general-purpose i/o, some ports are multiplexed with an alternate function for the peripheral features on the device. in general, when a peripheral is enabled, that pin may not be used as a general purpose i/o pin. port 1 is an 8-bit port directly controlled via the p1 sfr (sfr address = 90h). the port 1 pins are divided into two distinct pin groupings. p1.0 and p1.1 pins on port 1 are bidirectional digital i/o pins with internal pull-ups. if p1.0 and p1.1 have 1s written to them via the p1 sfr, these pins are pulled high by the internal pull- up resistors. in this state they can also be used as inputs. as input pins being externally pulled low, they source current because of the internal pull-ups. with 0s written to them, both of these pins drive a logic low output voltage (vol) and are capable of sinking 10 ma compared to the standard 1.6 ma sink capability on the other port pins. these pins also have various secondary functions described in table 20. table 20. port 1, alternate pin functions pin no. alternate function p1.0 t2 (timer/counter 2 external input) p1.1 t2ex (timer/counter 2 capture/reload trigger) the remaining port 1 pins (p1.2Cp1.7) can be configured only as analog input (adc), analog output (dac) or digital input pins. by default (power-on) these pins are configured as analog inputs, that is, 1 written in the corresponding port 1 register bit. to configure any of these pins as digital inputs, the user should write a 0 to these port bits to configure the corresponding pin as a high impedance digital input. port 3 is a bidirectional port with internal pull-ups directly con- trolled via the p3 sfr (sfr address = b0h). port 3 pins that have 1s written to them are pulled high by the internal pull-ups and in that state, they can be used as inputs. as inputs, port 3 pins being pulled externally low sources current because of the internal pull-ups. port 3 pins also have various secondary functions described in table 21. table 21. port 3, alternate pin functions pin no. alternate function p3.0 rxd (uart input pin) (or serial data i/o in mode 0) p3.1 txd (uart output pin) (or serial clock output in mode 0) p3.2 int0 (external interrupt 0) p3.3 int1 (external interrupt 1) p3.4 t0 (timer/counter 0 external input) p3.5 t1 (timer/counter 1 external input) ss (slave select in spi slave mode) p3.6 miso (master in slave out in spi mode) p3.7 mosi (master out slave in in spi mode) additional digital outputs pins pins p1.0 and p1.1 can be used to provide high current (10 ma sink) general-purpose i/o.
aduc814 rev. a | page 48 of 72 timers/counters the aduc814 has three 16-bit timer/counters: timer 0, timer 1, and timer 2. the timer/counter hardware has been included on-chip to relieve the processor core of the overhead inherent in implementing timer/counter functionality in software. each timer/counter consists of two 8-bit registers, thx and tlx (x = 0, 1 and 2). all three can be configured to operate either as timers or event counters. in timer function, the tlx register is incremented every machine cycle. thus one can think of it as counting machine cycles. since a machine cycle consists of 12 core clock periods, the maximum count rate is 1/12 of the core clock frequency. in counter function, the tlx register is incremented by a 1-to-0 transition at its corresponding external input pin, t0, t1, or t2. in this function, the external input is sampled during s5p2 of every machine cycle. when the samples show a high in one cycle and a low in the next cycle, the count is incremented. the new count value appears in the register during s3p1 of the cycle following the one in which the transition was detected. since it takes two machine cycles (16 core clock periods) to recognize a 1-to-0 transition, the maximum count rate is 1/16 of the core clock frequency. there are no restrictions on the duty cycle of the external input signal, but to ensure that a given level is sampled at least once before it changes, it must be held for a minimum of one full machine cycle. remember that the core clock frequency is programmed via the cd0Ccd2 selection bits in the pllcon sfr. user configuration and control of all timer operating modes is achieved via three sfrs: tmod, tcon, and t2con. tmod timer/counter 0 and 1 mode register sfr address 89h power-on default 00h bit addressable no gate c/t m1 m0 gate c/t m1 m0 table 22. tmod sfr bit designations bit name description 7 gate timer 1 gating control. set by software to enable timer/counter 1 only while int1 pin is high and tr1 control bit is set. cleared by software to enable timer 1 whenever tr1 control bit is set. 6 c/t timer 1 timer or counter select bit. set by software to select counte r operation (input from t1 pin). cleared by software to select timer opera tion (input from internal system clock). 5 m1 timer 1 mode select bit 1 (used with m0 bit). timer 1 mode select bit 0. m1 m0 0 0 th1 operates as an 8-bit timer/co unter. tl1 serves as 5-bit prescaler. 0 1 16-bit timer/counter. th1 and tl1 ar e cascaded; there is no prescaler. 1 0 8-bit auto-reload timer/counter. th1 holds a value which is to be reloaded into tl 1 each time it overflows. 4 m0 1 1 timer/counter 1 stopped. 3 gate timer 0 gating control. set by software to enable timer/counter 0 only while int0 pin is high and the tr0 control bit is set. cleared by software to enable timer 0 whenever the tr0 control bit is set. 2 c/ t timer 0 timer or counter select bit. set by software to select counte r operation (input from t0 pin). cleared by software to select timer opera tion (input from internal system clock). 1 m1 timer 0 mode select bit 1. timer 0 mode select bit 0. m1 m0 0 0 th0 operates as an 8-bit timer/co unter. tl0 serves as 5-bit prescaler. 0 1 16-bit timer/counter. th0 and tl0 ar e cascaded; there is no prescaler. 1 0 8-bit autoreload timer/counter. th0 holds a value which is to be reloaded into tl 0 each time it overflows. 0 m0 1 1 tl0 is an 8-bit timer/counter controlle d by the standard timer 0 control bits.
aduc814 rev. a | page 49 of 72 tcon timer/counter 0 and 1 control register sfr address 88h power-on default 00h bit addressable yes tf1 tr1 tf0 tr0 ie1 1 it1 1 ie0 it0 1 1 these bits are not used in the control of timer/counter 0 and 1, but are used instead in the control and monitoring of the exte rnal int0 and int1 interrupt pins. table 23. tcon sfr bit designations bit no. name description 7 tf1 timer 1 overflow flag. set by hardware on a timer/counter 1 overflow. cleared by hardware when the program counter (pc) vectors to the interrupt service routine. 6 tr1 timer 1 run control bit. set by the user to turn on timer/counter 1. cleared by the user to turn off timer/counter 1. 5 tf0 timer 0 overflow flag. set by hardware on a timer/counter 0 overflow. cleared by hardware when the pc vecto rs to the interrupt service routine. 4 tr0 timer 0 run control bit. set by the user to turn on timer/counter 0. cleared by the user to turn off timer/counter 0. 3 ie1 external interrupt 1 (int1 ) flag. set by hardware by a falling edge or zero level being applied to external interrupt pin int1 , depending on bit it1 state. cleared by hardware when the when the pc vectors to the interrupt service routine only if the interrupt was transition-activated. if level-activated, the external reques ting source controls the request flag, rather than the on- chip hardware. 2 it1 external interrupt 1 (ie1) trigger type. set by software to specify edge-sensitive detection, that is, 1-to-0 transition. cleared by software to specify level-sen sitive detection, that is, zero level. 1 ie0 external interrupt 0 (int0 ) flag. set by hardware by a falling edge or zero l evel being applied to exte rnal interrupt pin int0 , depending on bit it0 state. cleared by hardware when the pc vectors to the interrupt service routine, but only if the interrupt was transition- activated. if level-activated, the external requesting so urce controls the request flag, rather than the on-chip hardware. 0 it0 external interrupt 0 (ie0) trigger type. set by software to specify edge-sensitive detection, that is, 1-to-0 transition. cleared by software to specify level-sen sitive detection, that is, zero level. timer/counter 0 and 1 data registers each timer consists of two 8-bit registers. these can be used as independent registers or combined to be a single 16-bit regist er, depending on the timer mode configuration. th0 and tl0 timer 0 high byte and low byte. sfr address 8ch, 8ah, respectively th1 and tl1 timer 1 high byte and low byte. sfr address 8dh, 8bh, respectively
aduc814 rev. a | page 50 of 72 timer/counter 0 and 1 operating modes the following paragraphs describe the operating modes for timer/counters 0 and 1. unless otherwise noted, it should be assumed that these modes of operation are the same for both timer 0 and timer 1. mode 0 (13-bit timer/counter) mode 0 configures an 8-bit timer/counter with a divide-by-32 prescaler. figure 45 shows mode 0 operation. control tf0 tl0 (5 bits) tl0 (8 bits) interrupt p3.4/t0 gate tr0 p3.2/int0 02748-a-051 core clk* 12 c/t = 1 c/t = 0 *the core clock is the output of the pll figure 45. timer/counter 0, mode 0 in this mode, the timer register is configured as a 13-bit register. as the count rolls over from all 1s to all 0s, it sets the timer overflow flag tf0. the overflow flag, tf0, can then be used to request an interrupt. the counted input is enabled to the timer when tr0 = 1 and either gate = 0 or int0 = 1. setting gate = 1 allows the timer to be controlled by external input int0 to facilitate pulse width measurements. tr0 is a control bit in the special function register tcon; gate is in tmod. the 13-bit register consists of all eight bits of th0 and the lower five bits of tl0. the upper three bits of tl0 are indeterminate and should be ignored. setting the run flag (tr0) does not clear the registers. mode 1 (16-bit timer/counter) mode 1 is the same as mode 0, except that the timer register is running with all 16 bits. mode 1 is shown in figure 46. control tf0 tl0 (8 bits) tl0 (8 bits) interrupt p3.4/t0 gate tr0 p3.2/int0 02748-a-052 core clk* 12 c/t = 1 c/t = 0 *the core clock is the output of the pll figure 46. timer/counter 0, mode 1 mode 2 (8-bit timer/counter with autoreload) mode 2 configures the timer register as an 8-bit counter (tl0) with automatic reload, as shown in figure 47. overflow from tl0 not only sets tf0, but also reloads tl0 with the contents of th0, which is preset by software. the reload leaves th0 unchanged. control tf0 tl0 (8 bits) reload tl0 (8 bits) interrupt p3.4/t0 gate tr0 p3.2/int0 02748-a-053 core clk* 12 c/t = 1 c/t = 0 *the core clock is the output of the pll figure 47. timer/counter 0, mode 2 mode 3 (two 8-bit timer/counters) mode 3 has different effects on timer 0 and timer 1. timer 1 in mode 3 simply holds its count. the effect is the same as setting tr1 = 0. timer 0 in mode 3 establishes tl0 and th0 as two separate counters. this configuration is shown in figure 48. tl0 uses the timer 0 control bits: c/t, gate, tr0, int0 , and tf0. th0 is locked into a timer function (counting machine cycles) and takes over the use of tr1 and tf1 from timer 1. thus, th0 controls the timer 1 interrupt. mode 3 is provided for applica- tions requiring an extra 8-bit timer or counter. when timer 0 is in mode 3, timer 1 can be turned on and off by switching it out of, and into, its own mode 3, or can still be used by the serial interface as a baud rate generator. in fact, it can be used in any application not requiring an interrupt from timer 1 itself. control tf0 tl0 (8 bits) interrupt p3.4/t0 gate tr0 tf1 interrupt core clk/12 tr1 p3.2/int0 02748-a-054 core clk* core clk/12 12 tl0 (8 bits) c/t = 1 c/t = 0 *the core clock is the output of the pll figure 48. timer/counter 0, mode 3
aduc814 rev. a | page 51 of 72 t2con timer/counter 2 control register sfr address c8h power-on default 00h bit addressable yes tf2 exf2 rclk tclk exen2 tr2 cnt2 cap2 table 24. t2con sfr bit designations bit no. name description 7 tf2 timer 2 overflow flag. set by hardware on a timer 2 overflow. tf2 is not set when either rclk or tclk = 1. cleared by the user software. 6 exf2 timer 2 external flag. set by hardware when either a capture or reload is ca used by a negative transition on t2ex and exen2 = 1. cleared by the user software. 5 rclk receive clock enable. set by the user to enable the serial port to use timer 2 overflow pulses for its receive clock in serial port in modes 1 and 3. cleared by the user to enable timer 1 over flow to be used for the receive clock. 4 tclk transmit clock enable bit. set by the user to enable the serial port to use timer 2 overflow pulses for its trans mit clock in serial port modes 1 and 3. cleared by the user to enable timer 1 over flow to be used for the transmit clock. 3 exen2 timer 2 external enable flag. set by the user to enable a capture or reload to occur as a re sult of a negative transition on t2ex if timer 2 is not being used to clock the serial port. cleared by the user for timer 2 to ignore events at t2ex. 2 tr2 timer 2 start/stop control bit. set by the user to start timer 2. cleared by the user to stop timer 2. 1 cnt2 timer 2 timer or counter function select bit. set by the user to select counter func tion (input from external t2 pin). cleared by the user to select timer fu nction (input from on-chip core clock). 0 cap2 timer 2 capture/reload select bit. set by the user to enable captures on ne gative transitions at t2ex if exen2 = 1. cleared by the user to enable autorelo ads with timer 2 overflows or negative transitions at t2ex when exen2 = 1. when either rclk = 1 or tclk = 1, this bit is ignored an d the timer is forced to auto reload on timer 2 overflow. timer/counter 2 data registers timer/counter 2 also has two pairs of 8-bit data registers associ ated with it. these are used as both timer data registers and timer capture/reload registers. th2 and tl2 timer 2, data high byte and low byte. sfr address cdh, cch, respectively rcap2h and rcap2l timer 2, capture/reload byte and low byte. sfr address cbh, cah, respectively
aduc814 rev. a | page 52 of 72 timer/counter 2 operating modes this section describes the operating modes for timer/counter 2. the operating modes are selected by bits in the t2con sfr as shown in table 27. table 25. mode selection in t2con rclk (or) tclk cap2 tr2 mode 0 0 1 16-bit autoreload 0 1 1 16-bit capture 1 x 1 baud rate x x 0 off 16-bit autoreload mode in autoreload mode, there are two options that are selected by bit exen2 in t2con. if exen2 = 0, then when timer 2 rolls over, it not only sets tf2 but also causes the timer 2 registers to be reloaded with the 16-bit value in registers rcap2l and rcap2h, which are preset by software. if exen2 = 1, then timer 2 still performs the above, but with the added feature that a 1-to-0 transition at external input t2ex also triggers the 16-bit reload and sets exf2. the autoreload mode is illustrated in figure 49. 16-bit capture mode in the capture mode, there are again two options that are selected by bit exen2 in t2con. if exen2 = 0, then timer 2 is a 16-bit timer or counter which, upon overflowing, sets bit tf2, the timer 2 overflow bit, which can be used to generate an interrupt. if exen2 = 1, then timer 2 still performs the above, but a 1-to-0 transition on external input t2ex causes the cur- rent value in the timer 2 registers, tl2 and th2, to be captured into registers rcap2l and rcap2h, respectively. in addition, the transition at t2ex causes bit exf2 in t2con to be set, and exf2, like tf2, can generate an interrupt. capture mode is illustrated in figure 50. the baud rate generator mode is selected by rclk = 1 and/or tclk = 1. in either case, if timer 2 is being used to generate the baud rate, the tf2 interrupt flag does not occur. therefore timer 2 interrupts do not occur so they do not have to be disabled. in this mode, the exf2 flag, however, can still cause interrupts; this can be used as a third external interrupt. baud rate generation is described as part of the uart serial interface section that follows. tf2 core clk* 12 tr2 control tl2 (8 bits) tl2 (8 bits) capture exf2 timer interrupt exen2 control transition detector t2ex pin t2 pin rcap2l rcap2h c/t2 = 1 c/t2 = 0 *the core clock is the output of the pll 02748-a-055 figure 49. timer/counter 2, 16-bit autoreload mode tf2 core clk* 12 tr2 control tl2 (8 bits) tl2 (8 bits) capture exf2 timer interrupt exen2 control transition detector t2ex pin t2 pin rcap2l rcap2h c/t2 = 1 c/t2 = 0 *the core clock is the output of the pll 02748-a-056 figure 50. timer/counter 2, 16-bit capture mode
aduc814 rev. a | page 53 of 72 uart serial interface the serial port is full duplex, meaning it can transmit and receive simultaneously. it is also receive-buffered, meaning it can begin receiving a second byte before a previously received byte has been read from the receive register. however, if the first byte still has not been read by the time reception of the second byte is complete, the first byte is lost. the physical interface to the serial data network is via pins rxd (p3.0) and txd (p3.1), while the sfr interface to the uart is comprised of the following registers. sbuf the serial port receive and transmit registers are both accessed through the sbuf sfr (sfr address = 99h). writing to sbuf loads the transmit register and reading sbuf accesses a physically separate receive register. scon uart serial port control register sfr address 98h power-on default 00h bit addressable yes sm0 sm1 sm2 ren tb8 rb8 ti ri table 26. scon sfr bit designations bit no. name description 7 sm0 6 sm1 uart serial mode select bits. these bits select the serial po rt operating mode as follows: sm0 sm1 selected operating mode 0 0 mode 0: shift register, fixed baud rate (core_clk/2) 0 1 mode 1: 8-bit uart, variable baud rate 1 0 mode 2: 9-bit ua rt, fixed baud rate (core_clk/64) or (core_clk/32) 1 1 mode 3: 9-bit uart, variable baud rate 5 sm2 multiprocessor communication enable bit. enables multiprocessor communication in modes 2 and 3. in mode 0, sm2 should be cleared. in mode 1, if sm2 is set, ri is not acti vated if a valid stop bit is not received. if sm2 is cleared, ri is set as soon as the byte of data is received. in mode 2 or 3, if sm2 is set, ri is not activated if the received ninth data bit in rb 8 is 0. if sm2 is cleared, ri is set as soon as the byte of data is received. 4 ren serial port receive enable bit. set by the user software to enable serial port reception. cleared by the user software to disable serial port reception. 3 tb8 serial port transmit (bit 9). the data loaded into tb8 is the ninth data bit that is tr ansmitted in modes 2 and 3. 2 rb8 serial port receiver bit 9. the ninth data bit received in modes 2 and 3 is latched into rb8. for mode 1, the stop bit is latched into rb8. 1 ti set by hardware at the end of the ei ghth bit in mode 0, or at the beginning of the stop bit in modes 1, 2, and 3. cleared by the user software. 0 ri serial port receive interrupt flag. set by hardware at the end of the eigh th bit in mode 0, or halfway through the stop bit in modes 1, 2, and 3. cleared by user software.
aduc814 rev. a | page 54 of 72 mode 0: 8-bit shift register mode mode 0 is selected by clearing both the sm0 and sm1 bits in the sfr scon. serial data enters and exits through rxd. txd outputs the shift clock. eight data bits are transmitted or received. transmission is initiated by any instruction that writes to sbuf. the data is shifted out of the rxd line. the eight bits are transmitted with the least-significant bit (lsb) first, as shown in figure 52. reception is initiated when the receive enable bit (ren) is 1 and the receive interrupt bit (ri) is 0. when ri is cleared the data is clocked into the rxd line and the clock pulses are output from the txd line. mode 1: 8-bit uart, variable baud rate mode 1 is selected by clearing sm0 and setting sm1. each data byte (lsb first) is preceded by a start bit (bit 0) and followed by a stop bit (bit 1). therefore 10 bits are transmitted on txd or received on rxd. the baud rate is set by the timer 1 or timer 2 overflow rate, or a combination of the two (one for transmission and the other for reception). transmission is initiated by writing to sbuf. the write-to- sbuf signal also loads a 1 (stop bit) into the ninth bit position of the transmit shift register. the data is output bit by bit until the stop bit appears on txd and the transmit interrupt flag (ti) is automatically set as shown in figure 51. reception is initiated when a 1-to-0 transition is detected on rxd. assuming a valid start bit was detected, character reception continues. the start bit is skipped and the eight data bits are clocked into the serial port shift register. when all eight bits have been clocked in, the following events occur: ? the eight bits in the receive shift register are latched into sbuf. ? the ninth bit (stop bit) is clocked into rb8 in scon. the receiver interrupt flag (ri) is set if, and only if, the following conditions are met at the time the final shift pulse is generated: o ri = 0 o either sm2 = 0 or sm2 = 1 and the received stop bit = 1 if either of these conditions is not met, the received frame is irretrievably lost, and ri is not set. txd ti (scon. 1) start bit d0 d1 d2 d3 d4 d5 d6 d7 stop bit set interrupt i.e., ready for more data 02748-a-058 figure 51. uart serial port transmission, mode 1 02748-a-057 core clk ale rxd (data out) txd (shift clock) data bit 0 data bit 1 data bit 6 data bit 7 s6 s5 s4 s3 s2 s1 s6 s5 s4 s4 s3 s2 s1 s6 s5 s4 s3 s2 s1 machine cycle 8 machine cycle 7 machine cycle 2 machine cycle 1 figure 52. uart serial port transmission, mode 0
aduc814 rev. a | page 55 of 72 mode 2: 9-bit uart with fixed baud rate mode 2 is selected by setting sm0 and clearing sm1. in this mode, the uart operates in 9-bit mode with a fixed baud rate. the baud rate is fixed at core_clk/64 by default, although by setting the smod bit in pcon, the frequency can be doubled to core_clk/32. eleven bits are transmitted or received, a start bit (bit 0), eight data bits, a programmable ninth bit, and a stop bit (bit 1). the ninth bit is most often used as a parity bit, although it can be used for anything, including a ninth data bit if required. to transmit, the eight data bits must be written into sbuf. the ninth bit must be written into tb8 in scon. when transmission is initiated, the eight data bits (from sbuf) are loaded into the transmit shift register (lsb first). the contents of tb8 are loaded into the ninth bit position of the transmit shift register. the transmission starts at the next valid baud rate clock. the ti flag is set as soon as the stop bit appears on txd. reception for mode 2 is similar to that of mode 1. the eight data bytes are input at rxd (lsb first) and loaded into the receive shift register. when all eight bits have been clocked in, the following events occur: ? the eight bits in the receive shift register are latched into sbuf. ? the ninth data bit is latched into rb8 in scon. ? the receiver interrupt flag (ri) is set if, and only if, the following conditions are met at the time the final shift pulse is generated: o ri = 0 o either sm2 = 0 or sm2 = 1 and the received stop bit = 1 if either of these conditions is not met, the received frame is irretrievably lost, and ri is not set. mode 3: 9-bit uart with variable baud rate mode 3 is selected by setting both sm0 and sm1. in this mode, the 8051 uart serial port operates in 9-bit mode with a variable baud rate determined by either timer 1 or timer 2. the operation of the 9-bit uart is the same as for mode 2 but the baud rate can be varied as for mode 1. in all four modes, transmission is initiated by any instruction that uses sbuf as a destination register. reception is initiated in mode 0 by the condition ri = 0 and ren = 1. reception is initiated in the other modes by the incoming start bit if ren = 1. uart serial port baud rate generation in these descriptions that follow, core clock frequency refers to the core clock frequency selected via the cd0Ccd2 bits in the pllcon sfr. mode 0 baud rate generation the baud rate in mode 0 is fixed: mode 0 baud rate = ( core clock frequency /12) mode 2 baud rate generation the baud rate in mode 2 depends on the value of the smod bit in the pcon sfr. if smod = 0, the baud rate is 1/64 of the core clock. if smod = 1, the baud rate is 1/32 of the core clock: mode 2 baud rate = (2 smod /64) ( core clock frequency ) mode 1 and 3 baud rate generation the baud rates in modes 1 and 3 are determined by the over- flow rate in timer 1 or timer 2, or both (one for transmit and the other for receive). timer 1 generated baud rates when timer 1 is used as the baud rate generator, the baud rates in modes 1 and 3 are determined by the timer 1 overflow rate and the value of smod as follows: modes 1 and 3 baud rate = (2 smod /32) ( timer 1 overflow rate) the timer 1 interrupt should be disabled in this application. the timer itself can be configured for either timer or counter operation, and in any of its three running modes. in the most typical application, it is configured for timer operation, in the autoreload mode (high nibble of tmod = 0100 binary). in that case, the baud rate is given by the formula modes 1 and 3 baud rate = (2 smod /32) ( core clock / (12 [256 ? th1 ])) a very low baud rate can also be achieved with timer 1 by leav- ing the timer 1 interrupt enabled, and configuring the timer to run as a 16-bit timer (high nibble of tmod = 0100 binary), and using the timer 1 interrupt to do a 16-bit software reload. table 27 shows some commonly used baud rates and how they might be calculated from a core clock frequency of 2.0971 mhz and 16.78 mhz. generally speaking, a 5% error is tolerable using asynchronous (start/stop) communications. table 27. commonly used baud rates, timer 1 ideal baud core clk smod value th1-reload value actual baud % error 9600 16.78 1 C9 (f7h) 9709 1.14 2400 16.78 1 C36 (dch) 2427 1.14 1200 16.78 1 C73 (b7h) 1197 0.25 1200 2.10 1 C9 (f7h) 1213 1.14
aduc814 rev. a | page 56 of 72 timer 2 generated baud rates baud rates can also be generated using timer 2. using timer 2 is similar to using timer 1 in that the timer must overflow 16 times before a bit is transmitted/received. because timer 2 has a 16-bit autoreload mode, a wide range of baud rates is possible using timer 2. modes 1 and 3 baud rate = (1/16) ( timer 2 overflow rate ) therefore, when timer 2 is used to generate baud rates, the timer increments every two clock cycles and not every core machine cycle as before. therefore, it increments six times faster than timer 1, and therefore baud rates six times faster are possible. because timer 2 has 16-bit autoreload capability, very low baud rates are still possible. timer 2 is selected as the baud rate generator by setting the clk and/or rclk in t2con. the baud rates for transmit and receive can be simultaneously different. setting rclk and/or tclk puts timer 2 into its baud rate generator mode as shown in figure 53. in this case, the baud rate is given by the formula modes 1 and 3 baud rate = ( core clk )/ (32 [65536 C ( rcap2h , rcap2l )]) table 28 shows some commonly used baud rates and how they could be calculated from a core clock frequency of 2.0971 mhz and 16.7772 mhz. table 28. commonly used baud rates, timer 2 ideal baud core clk rcap2h value rcap2l value actual baud % error 19200 16.78 C1 (ffh) C27 (e5h) 19418 1.14 9600 16.78 C1 (ffh) C55 (c9h) 9532 0.7 2400 16.78 C1 (ffh) C218 (26h) 2405 0.21 1200 16.78 C2 (feh) C181 (4bh) 1199 0.02 9600 2.10 C1 (ffh) C7 (fbh) 9362 2.4 2400 2.10 C1 (ffh) C27 (ech) 2427 1.14 1200 2.10 C1 (ffh) C55 (d7h) 1191 0.7 core clk* 2 2 16 16 tr2 control reload tl2 (8 bits) tl2 (8 bits) exen2 control note: availability of additional external interrupt note: oscillator frequency is divided by 2, not 12 transition detector t2ex pin t2 pin rcap2l rcap2h c/t2 = 1 c/t2 = 0 *the core clock is the output of the pll 02748-a-059 rclk tclk rx clock tx clock 0 0 1 1 1 0 smod timer 2 overflow timer 1 overflow exf 2 timer 2 interrupt figure 53. timer 2, uart baud rates
aduc814 rev. a | page 57 of 72 interrupt system the aduc814 provides a total of twelve interrupt sources with two priority levels. the control and configuration of the interru pt system is carried out through three interrupt-related sfrs. ie interrupt enable register ip interrupt priority register ieip2 secondary interrupt enable and priority register ie interrupt enable register sfr address a8h power-on default 00h bit addressable yes ea eadc et2 es et1 ex1 et0 ex0 table 29. ie sfr bit designations bit no. name description 7 ea global interrupt enable. set by the user to enable all interrupt sources. cleared by the user to disa ble all interrupt sources. 6 eadc adc interrupt. set by the user to enable the adc interrupt. cleared by the user to disable the adc interrupt. 5 et2 timer 2 interrupt. set by the user to enable the timer 2 interrupt. cleared by the user to di sable the timer 2 interrupt. 4 es uart serial port interrupt. set by the user to enable the uart serial port interrupt. cleared by the user to disable the uart serial port interrupt. 3 et1 timer 1 interrupt. set by the user to enable the timer 1 interrupt. cleared by the user to di sable the timer 1 interrupt. 2 ex1 int1 interrupt. set by the user to enable the external interrupt 1. cleared by the user to disabl e the external interrupt 1. 1 et0 timer 0 interrupt. set by the user to enable the timer 0 interrupt. cleared by the user to di sable the timer 0 interrupt. 0 ex0 int0 interrupt. set by the user to enable the external interrupt 0. cleared by the user to disabl e the external interrupt 0.
aduc814 rev. a | page 58 of 72 ip interrupt priority register sfr address b8h power-on default 00h bit addressable yes --- padc pt2 ps pt1 px1 pt0 px0 table 30. ip sfr bit designations bit no. name description 7 --- reserved. 6 padc adc interrupt priority. written to by user to set interrupt priority level (1 = high; 0 = low). 5 pt2 timer 2 interrupt priority. written to by the user to set interru pt priority level (1 = high; 0 = low). 4 ps uart serial port interrupt priority. written to by the user to set interru pt priority level (1 = high; 0 = low). 3 pt1 timer 1 interrupt priority. written to by the user to set interru pt priority level (1 = high; 0 = low). 2 px1 external interrupt 1 priority (int1). written to by the user to set interru pt priority level (1 = high; 0 = low). 1 pt0 timer 0 interrupt priority. written to by the user to set interru pt priority level (1 = high; 0 = low). 0 px0 external interrupt 0 priority (int0). written to by the user to set interru pt priority level (1 = high; 0 = low). ieip2 secondary interrupt enable and priority register sfr address a9h power-on default a0h bit addressable no --- pt1 ppsm psi --- eti epsm esi table 31. ieip2 sfr bit designations bit no. name description 7 --- reserved. 6 pti time interval coun ter interrupt priority. written to by the user to set tic in terrupt priority (1 = high; 0 = low). 5 ppsm psm interrupt priority. written to by the user to select power supply monitor interrupt priority (1 = high; 0 = low). 4 psi spi serial port interrupt priority. written to by the user to select spi serial port interrupt priority (1 = high; 0 = low). 3 --- reserved. this bit must be 0. 2 eti tic interrupt. set by the user to enable the tic interrupt. cleared by the user to disable the tic interrupt. 1 epsm power supply monitor interrupt. set by the user to enable the power supply monitor interrupt. cleared by the user to disable th e power supply monitor interrupt. 0 esi spi serial port interrupt. set by the user to enable the spi serial port interrupt. cleared by the user to disabl e the spi serial port interrupt.
aduc814 rev. a | page 59 of 72 interrupt priority the interrupt enable registers are written by the user to enable individual interrupt sources, while the interrupt priority registers allow the user to select one of two priority levels for each interrupt. an interrupt of a high priority may interrupt the service routine of a low priority interrupt, and if two interrupts of different priority occur at the same time, the higher level interrupt is serviced first. an interrupt cannot be interrupted by another interrupt of the same priority level. if two interrupts of the same priority level occur simultaneously, a polling sequence is observed as shown in table 32. table 32. priority within an interrupt level source priority description psmi 1 (highest) power supply monitor interrupt wds 2 watchdog interrupt ie0 3 external interrupt 0 rdy0/rdy1 4 adc interrupt tf0 5 timer/counter 0 interrupt ie1 6 external interrupt 1 tf1 7 timer/counter 1 interrupt ispi 8 spi interrupt ri + ti 9 serial interrupt tf2 + exf2 10 timer/counter 2 interrupt tii 11 (lowest) time inte rval counter interrupt interrupt vectors when an interrupt occurs, the program counter is pushed onto the stack, and the corresponding interrupt vector address is loaded into the program counter. the interrupt vector addresses are shown in table 33. table 33. interrupt vector addresses source vector address ie0 0003h tf0 000bh ie1 0013h tf1 001bh ri + ti 0023h tf2 + exf2 002bh rdy0/rdy1 (adc) 0033h ispi 003bh psmi 0043h tii 0053h wds (wdir = 1) 1 005bh 1 the watchdog can be configured to ge nerate an interrupt instead of a reset when it times out. this is used for lo gging errors or to examine the internal status of the microcontroller core to understand, from a software debug point of view, why a watchdog timeout occurre d. the watchdog interrupt is slightly different from normal interrupts in that its priority level is always set to 1, and it is not possible to disable the interrupt v ia the global disable bit (ea) in the ie sfr. this is done to ensure that the interrupt is always responded to if a watchdog timeout occurs. the watchdog produces an interrupt only if the watchdog timeout is greater than zero.
aduc814 rev. a | page 60 of 72 aduc814 hardware design considerations this section outlines some key hardware design considerations for integrating the aduc814 into any hardware system. clock oscillator as described earlier, the core clock frequency for the aduc814 is generated from an on-chip pll that locks onto a multiple (512 times) of 32.768 khz. the latter is generated from an internal clock oscillator. to use the internal clock oscillator, connect a 32.768 khz parallel resonant crystal between xtal1 and xtal2 pins (pins 26 and 27) as shown in figure 54. as shown in the typical external crystal connection diagram in figure 54, two internal 12 pf capacitors are provided on-chip. these are connected internally, directly to the xtal1 and xtal2 pins. the total input capacitances at both pins is detailed in the specifications table. the value of the total load capacitance required for the external crystal should be the value recommended by the crystal manufacturer for use with that specific crystal. in many cases, because of the on-chip capacitors, additional external load capacitors are not required. aduc814 to pll 12pf 12pf xtal1 xtal2 02748-a-060 figure 54. external parallel resonant crystal connections as an alternative to providing two separate power supplies, av dd can be kept quiet by placing a small series resistor and/or ferrite bead between it and dv dd , and then decoupling av dd separately to ground. an example of this configuration is shown in figure 56. with this configuration, other analog circuitry (such as op amps and voltage reference) can be powered from the av dd supply line as well. power supplies the aduc814s operational power supply voltage range is 2.7 v to 5.5 v. although the guaranteed data sheet specifications are given only for power supplies within 2.7 v to 3.3 v or 4.5 v to 5.5 v, (10% of the nominal level), the chip can function equally well at any power supply level between 2.7 v and 5.5 v. users should separate analog and digital power supply pins (av dd and dv dd ) and allow av dd to be kept relatively free of noisy digital signals often present on the system dv dd line. in this mode, the part can also operate with split supplies as long as the supply voltages are within 0.3 v of each other. a typical split-supply configuration is show in figure 55. dv dd agnd av dd ? + 0.1 f 10 f analog supply 10 f dgnd 0.1 f digital supply ? + aduc814 02748-a-061 figure 55. external dual-supply connections dv dd agnd av dd dgnd digital supply ? + bead 1.6 ? 0.1 f 0.1 f 10 f 10 f aduc814 02748-a-062 figure 56. external single-supply connections notice that in both figure 55 and figure 56, a large value (10 f) reservoir capacitor sits on dv dd and a separate 10 f capacitor sits on avdd. also, local small-value (0.1 f) capacitors are located at each v dd pin of the chip. as per standard design practice, be sure to include all of these capacitors, and ensure that the smaller capacitors are closest to each av dd pin with trace lengths as short as possible. connect the ground terminal of each of these capacitors directly to the underlying ground plane. finally, note that, at all times, the analog and digital ground pins on the aduc814 should be referenced to the same system ground reference point. power consumption the core values given represent the current drawn by dv dd , while the rest (adc and dac) are pulled by the av dd pin and can be disabled in software when not in use. the other on-chip peripherals (such as watchdog timer and power supply monitor) consume negligible current and are therefore lumped in with the core operating current here. of course, the user must add any currents sourced by the parallel and serial i/o pins, and that sourced by the dac, in order to determine the total current needed at the aduc814s supply pins. also, current drawn from the dvdd supply increases by approximately 5 ma during the flash/ee erase and program cycles.
aduc814 rev. a | page 61 of 72 power-saving modes setting the idle and power-down mode bits, pcon.0 and pcon.1, respectively, in the pcon sfr described in table 5, allows the chip to be switched from normal mode to idle mode, and also to full power-down mode. in idle mode, the oscillator continues to run, but the core clock generated from the pll is halted. the on-chip peripherals con- tinue to receive the clock and remain functional. the cpu status is preserved with the stack pointer, program counter, and all other internal registers maintaining their data during idle mode. port pins and dac output pins also retain their states in this mode. the chip recovers from idle mode upon receiving any enabled interrupt, or upon receiving a hardware reset. in power-down mode, both the pll and the clock to the core are stopped. the on-chip oscillator can be halted or can continue to oscillate depending on the state of the oscillator power-down bit (osc_pd) in the pllcon sfr. the tic, being driven directly from the oscillator, can also be enabled during power-down. all other on-chip peripherals however, are shut down. port pins retain their logic levels in this mode, but the dac output goes to a high impedance state (three-state). during full power-down mode, the aduc814 consumes a total of 5 a typically. there are five ways of terminating power- down mode, as described in the next sections. asserting reset (pin 10) returns to normal mode and all registers are set to their default state. program execution starts at the reset vector once the reset pin is de-asserted. cycling power all registers are set to their default state and program execution starts at the reset vector. time interval counter (tic) interrupt power-down mode is terminated and the cpu services the tic interrupt. the reti at the end of the tic interrupt service routine returns the core to the instruction following the one that enabled power-down. spi interrupt power-down mode is terminated and the cpu services the spi interrupt. the reti at the end of the isr returns the core to the instruction following the one that enabled power-down. note that the spi power-down interrupt enable bit (seripd) in the pcon sfr must first be set to allow this mode of operation. i n t 0 interrupt power-down mode is terminated and the cpu services the int0 interrupt. the reti at the end of the isr returns the core to the instruction following the one that enabled power-down. the int0 pin must not be driven low during or within two machine cycles of the instruction that initiates power-down mode. note that the i n t 0 power-down interrupt enable bit (int0pd) in the pcon sfr must first be set to allow this mode of operation. power-on reset an internal por (power-on-reset) is implemented on the aduc814. for dv dd below 2.45 v, the internal por holds the aduc814 in reset. as dv dd rises above 2.45 v, an internal timer times out for approximately128 ms before the part is released from reset. the user must ensure that the power supply has reached a stable 2.7 v minimum level by this time. likewise on power-down, the internal por holds the aduc814 in reset until the power supply has dropped below 1 v. figure 57 illustrates the operation of the internal por in detail. 128ms typ 1.0v 128ms typ 2.45v typ 1.0v typ internal core reset dv dd 02748-a-063 figure 57. internal por operation grounding and board layout recommendations as with all high resolution data converters, special attention must be paid to grounding and pc board layout of aduc814 based designs in order to achieve optimum performance from the adcs and dac. although the aduc814 has separate pins for analog and digital ground (agnd and dgnd), the user must not tie these to two separate ground planes unless the two ground planes are connected together very close to the aduc814, as illustrated in the simplified example of figure 58a. in systems where digital and analog ground planes are connected together somewhere else (at the systems power supply for example), they cannot be connected again near the aduc814 because a ground loop would result. in these cases, tie all of the aduc814s agnd and dgnd pins to the analog ground plane, as illustrated in figure 58b. in systems with only one ground plane, ensure that the digital and analog components are physically separated onto separate halves of the board such that digital return currents do not flow near analog circuitry and vice versa. the aduc814 can then be plac ed between the digital and analog sections, as illustrated in figure 58c.
aduc814 rev. a | page 62 of 72 dgnd agnd gnd place digital components here place digital components here place digital components here place analog components here place analog components here place analog components here dgnd a. agnd b. c. 02748-a-064 figure 58. system grounding schemes in all of these scenarios, and in more complicated real-life appli- cations, keep in mind the flow of current from the supplies and back to ground. make sure the return paths for all currents are as close as possible to the paths the currents took to reach their destinations. for example, do not put power components on the analog side of figure 58b with dv dd because that would force return currents from dv dd to flow through agnd. also, try to avoid digital currents flowing under analog circuitry, which could happen if a noisy digital chip is placed on the left half of the board in figure 58c. whenever possible, avoid large discontinuities in the ground plane(s) (such as are formed by a long trace on the same layer), because they force return signals to travel a longer path. and of course, make all connections to the ground plane directly, with little or no trace separating the pin from its via to ground. if the user plans to connect fast logic signals (rise/fall time < 5 ns) to any of the aduc814s digital inputs, add a series resistor to each relevant line to keep rise and fall times longer than 5 ns at the aduc814 input pins. a value of 100 ? or 200 ? is usually sufficient to prevent high speed signals from coupling capacitively into the aduc814 and affecting the accuracy of adc conversions. other hardware considerations to facilitate in-circuit programming, in-circuit debug, and emulation options, users should implement some simple connection points in their hardware. a typical aduc814 connection diagram is shown in figure 59. in-circuit serial download access nearly all aduc814 designs will want to take advantage of the in-circuit reprogrammability of the chip. this is accomplished by a connection from the aduc814s uart to a pc, which requires an external rs-232 chip for level translation. if users would rather not design an rs-232 chip onto a board, refer to the application note uc006, a 4-wire uart-to-pc interface (available at www.analog.com/microconverter ) for a simple (and zero-cost-per-board) method of gaining in-circuit serial download access to the aduc814. in addition to the basic uart connections, users also need a way to trigger the chip into download mode. this is accom- plished via a 1 k? pull-up resistor that can be jumpered onto the dload pin. to get the aduc814 into download mode, simply connect this jumper and power-cycle the device (or manually reset the device, if a manual reset button is available), and it will be ready to receive a new program serially. to enable the device to enter normal mode (and run the program) when- ever power is cycled or reset is toggled, the dload pin must be pulled low through a 1 k? resistor. embedded serial port debugger from a hardware perspective, entry to serial port debug mode is identical to the serial download entry sequence described in the preceding section. in fact, both serial download and serial port debug modes can be thought of as essentially one mode of operation used in two different ways. note that the serial port debugger is fully contained on the aduc814 device, unlike rom monitor type debuggers.
aduc814 rev. a | page 63 of 72 1 3 4 5 6 7 8 9 10 11 12 13 14 2 1 3 4 5 6 7 8 2 16 14 13 12 11 10 9 15 28 26 25 24 23 22 21 20 19 18 17 16 15 27 aduc814 adm202 dgnd dload rxd txd reset adc0 10nf av dd av dd dv dd agnd dac1 output dac0 output 0.1 f 0.1 f 32.766khz 0.1 f r2in t2out v? c2? c2+ c1? v1+ c1+ 1 2 3 4 5 6 7 8 9 dv dd dv dd dv dd dv dd xtal2 xtal1 2-pin header for emulation access (normally open) down load/debug enable jumper (normally open) analog input v ref v ref output v cc gnd t1out r1in r1out t1in r2out t2in c ref agnd dac0 dac1 1k ? 10 ? 02748-a-065 figure 59. typical aduc814 system connection diagram single-pin emulation mode also built into the aduc814 is a dedicated controller for single- pin in-circuit emulation (ice) using standard production aduc814 devices. in this mode, emulation access is gained by connection to a single pin, again the dload pin is used for this function. as described previously, this pin is either high to enable entry into serial download and serial debug modes or low to select normal code execution. to enable single-pin emulation mode, however, users need to pull the dload pin high through a 1 k? resistor. the emulator then connects to the 2-pin header. to be compatible with the standard connector that comes with the single-pin emulator available from accutron limited (www.accutron.com), use a 2-pin 0.1-inch pitch friction lock header from molex (www.molex.com) such as their part number 22-27-2021. be sure to observe the polarity of this header. when the friction lock tab is at the right, the ground pin should be the lower of the two pins (when viewed from the top).
aduc814 rev. a | page 64 of 72 timing specifications 1,2,3 table 34. clock input (external clock driven xtal1) av dd = 2.7 v to 3.3 v or 4.75 v to 5.25 v, dv dd = 2.7 v to 3.3 v or 4.75 v to 5.25 v; all specifications t min to t max , unless otherwise noted 32.768 khz external crystal parameter min typ max unit t ck xtal1 period 30.52 s t ckl xtal1 width low 15.16 s t ckh xtal1 width high 15.16 s t ckr xtal1 rise time 20 ns t ckf xtal1 fall time 20 ns 1/t core aduc814 core clock frequency 4 0.131 16.78 mhz t core aduc814 core clock period 5 0.476 s t cyc aduc814 machine cycle time 6 0.72 5.7 91.55 s 1 ac inputs during testing are driven at dv dd C 0.5 v for a logic 1, and at 0.45 v for a logic 0. timing measurements are made at v ih min for a logic 1, and at v il max for a logic 0 as shown in figure 61. 2 for timing purposes, a port pin is no long er floating when a 100 mv change from load voltage occurs. a port pin begins to floa t when a 100 mv change from the loaded v oh /v ol level occurs as shown in figure 61. 3 c load for all outputs = 80 pf, unless otherwise noted. 4 aduc814 internal pll locks onto a multip le (512 times) the external crystal freque ncy of 32.768 khz to pr ovide a stable 16.777 216 mhz internal clock for the system. the core can operate at this frequency or at a binary submultiple called core_clk, selected via the pllcon sfr. 5 this number is measured at the default core_clk operating frequency of 2.09 mhz. 6 aduc814 machine cycle time is nominally defined as 12/core_clk. t ckh t ckl t ck t ckf t ckr 02748-a-002 figure 60. xtal1 input dv dd ? 0.5v 0.45v 0.2dv dd +0.9v test points 0.2dv dd ?0.1v v load ? 0.1v v load v load + 0.1v v load ? 0.1v v load + 0.1v timing reference point v load 02748-a-003 figure 61. timing waveform characteristics
aduc814 rev. a | page 65 of 72 table 35. uart timing (shift register mode) 16.78 mhz core_clk variable core_clk parameter min typ max min typ max unit t xlxl serial port clock cycle time 715 12 t core s t qvxh output data setup to clock 463 10 t core C133 ns t dvxh input data setup to clock 252 2 t core +133 ns t xhdx input data hold after clock 0 0 ns t xhqx output data hold after clock 22 2 t core C117 ns set ri or set ti bit 6 t xlxl txd (output clock) rxd (output data) rxd (input data) bit 1 lsb lsb bit 1 bit 6 msb t xhqx t qvxh t dvxh t xhdx 02748-a-004 figure 62. uart timing in shift register mode
aduc814 rev. a | page 66 of 72 table 36. spi master mode timing (cpha = 1) parameter min typ max unit t sl sclock low pulse width 1 630 ns t sh sclock high pulse width 1 630 ns t dav data output valid after sc lock edge 50 ns t dsu data input setup time before sclock edge 100 ns t dhd data input hold time afte r sclock edge 100 ns t df data output fall time 10 25 ns t dr data output rise time 10 25 ns t sr sclock rise time 10 25 ns t sf sclock fall time 10 25 ns 1 characterized under the following conditions: a. core clock divider bits cd2, cd1, and cd0 in pllcon sfr set to 0, 1, and 1, respectively, i.e., core clock frequency = 2. 09 mhz. b. spi bit-rate selection bits spr1 and spr0 bits in spicon sfr set to 0 and 0, respectively. sclock (cpol = 0) sclock (cpol = 1) mosi miso msb lsb lsb in bits 6?1 bits 6?1 msb in t dav t dsu t dhd t dr t df t sh t sl t sr t sf 02748-a-005 figure 63. spi master mode timing (cpha = 1)
aduc814 rev. a | page 67 of 72 table 37. spi master mode timing (cpha = 0) parameter min typ max unit t sl sclock low pulse width 1 630 ns t sh sclock high pulse width 1 630 ns t dav data output valid after sc lock edge 50 ns t dosu data output setup before sc lock edge 150 ns t dsu data input setup time before sclock edge 100 ns t dhd data input hold time afte r sclock edge 100 ns t df data output fall time 10 25 ns t dr data output rise time 10 25 ns t sr sclock rise time 10 25 ns t sf sclock fall time 10 25 ns 1 characterized under the following conditions: a. core clock divider bits cd2, cd1, and cd0 bits in pllcon sfr set to 0, 1, and 1, respectively, i.e., core clock frequency = 2.09 mhz. b. spi bit-rate selection bits spr1 and spr0 bits in spicon sfr set to 0 and 0, respectively. sclock (cpol = 0) sclock (cpol = 1) mosi miso msb lsb lsb in bits 6?1 bits 6?1 msb in t dav t dosu t dsu t dhd t dr t df t sh t sl t sr t sf 02748-a-006 figure 64. spi master mode timing (cpha = 0)
aduc814 rev. a | page 68 of 72 table 38. spi slave mode timing (cpha = 1) parameter min typ max unit t ss ss to sclock edge 0 ns t sl sclock low pulse width 330 ns t sh sclock high pulse width 330 ns t dav data output valid after sclock edge 50 ns t dsu data input setup time befo re sclock edge 100 ns t dhd data input hold time af ter sclock edge 100 ns t df data output fall time 10 25 ns t dr data output rise time 10 25 ns t sr sclock rise time 10 25 ns t sf sclock fall time 10 25 ns t sfs ss high after sclock edge 0 ns sclock (cpol = 0) sclock (cpol = 1) mosi miso msb lsb lsb in bits 6?1 bits 6?1 msb in t dav t dsu t dhd t dr t df t sh t sl t sr t sf t sfs t ss t df 02748-a-007 ss figure 65. spi slave mode timing (cpha = 1)
aduc814 rev. a | page 69 of 72 table 39. spi slave mode timing (cpha = 0) parameter min typ max unit t ss ss to sclock edge 0 t sl sclock low pulse width 330 ns t sh sclock high pulse width 330 ns t dav data output valid after sclock edge 50 ns t dsu data input setup time befo re sclock edge 100 ns t dhd data input hold time af ter sclock edge 100 ns t df data output fall time 10 25 ns t dr data output rise time 10 25 ns t sr sclock rise time 10 25 ns t sf sclock fall time 10 25 ns t ssr ss to sclock edge 50 ns t doss data output valid after ss edge 20 ns t sfs ss high after sclock edge 0 ns sclock (cpol = 0) ss sclock (cpol = 1) mosi miso msb lsb lsb in bits 6?1 bits 6?1 msb in t dav t dosu t dsu t dhd t dr t df t sh t ss t sl t sr t sf t sfs 02748-a-008 figure 66. spi slave mode timing (cpha = 0)
aduc814 rev. a | page 70 of 72 outline dimensions 28 15 14 1 8 0 compliant to jedec standards mo-153ae seating plane coplanarity 0.10 1.20 max 6.40 bsc 0.65 bsc pin 1 0.30 0.19 0.20 0.09 4.50 4.40 4.30 0.75 0.60 0.45 9.80 9.70 9.60 0.15 0.05 figure 67. 28-lead thin shrink sm all outline package (tssop) (ru-28) dimensions shown in mm
aduc814 rev. a | page 71 of 72 ordering guide model temperature range package description package option ADUC814ARU ?40c to +125c thin sh rink small outline (tssop) ru-28 ADUC814ARU-reel ?40c to +125c thin sh rink small outline (tssop) ru-28 ADUC814ARU-reel7 ?40c to +125c thin shrink small outline (tssop) ru-28 aduc814bru ?40c to +125c thin sh rink small outline (tssop) ru-28 aduc814bru-reel ?40c to +125c thin sh rink small outline (tssop) ru-28 aduc814bru-reel7 ?40c to +125c thin shrink small outline (tssop) ru-28 quickstart development system model description eval-aduc814qs development system for the aduc814 microconverter eval-aduc814qsp 1 quickstart plus development system 1 only available to order through the web.
aduc814 rev. a | page 72 of 72 notes purchase of licensed i 2 c components of analog devices or one of its sublicensed associ ated companies conveys a license for the purchaser under the phi lips i 2 c patent rights to use these components in an i 2 c system, provided that the system conforms to the i 2 c standard specification as defined by philips. ? 2003 analog devices, inc. all rights reserved. trademarks and registered trademarks are the prop erty of their respective owners. c02748-0-12/03(a)


▲Up To Search▲   

 
Price & Availability of ADUC814ARU

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X